帮助学习使用 Irony for .net
我正在尝试加快 Irony 的步伐。我不断看到一些我还不理解的术语:终端、非终端、令牌、状态机、关联性、抽象语法树。
有人可以解释其中一些术语的含义吗?我一直在阅读有关 Irony 的精彩文章,因此如果您能在学习如何使用它方面提供任何帮助,那就太好了。
粗体编辑内容
I am trying to get up to speed with Irony. I keep seeing some terminology that I don't yet understand: terminals, non-terminals, token, state machine, Associativity, Abstract Syntax Tree.
Can someone please give some meaning to some of these terms? I keep reading great things about Irony, so any help you can give with learning how to use it would be great.
Edits in bold
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些术语并不是 Irony 特有的,而是来自计算机科学的概念。
标记是解析的原子元素,在标记化时无法进一步分解。分词是词法分析的一个子集。听起来您通常不熟悉解析背后的理论 - 更多在维基百科< /a>. 这里也有好东西。
终结符和非终结符是指令牌的类型。有关这些的详细信息,请参阅我的第二个链接。
编辑:抽象语法树是解析中的另一个概念。由于这些都是不特定于 Irony 的概念,因此您只需通过 Google 搜索或在 Wikipedia 上查找即可找到很多内容。干杯!
These terms are not specific to Irony, but are concepts from computer science.
A token is an atomic element of parsing, one which cannot be broken down further when tokenizing. Tokenizing is a subset of lexical analysis. It sounds like you're generally unfamiliar with the theory behind parsing - lots more over at Wikipedia. Good stuff here as well.
Terminals and non-terminals refer to types of tokens. See my 2nd link for details on those.
Edit: an abstract syntax tree is yet another concept in parsing. Since these are all concepts which are not specific to Irony, you can find a lot just by Googling or looking on Wikipedia. Cheers!
结合性是数学术语,是运算符的属性。如果对于所有
a
、b
和c
,则称运算符o
是结合律的(aob) oc = ao (boc)
因此,表达式
aobo c
不需要括号即可明确。例如,加法运算符
+
与整数关联:无论我们以哪种顺序计算+
,1 + 2 + 3
都具有相同的值但减法运算符-
是不是:1 - 2 - 3
意味着两个不同的事物,具体取决于哪个-
我们首先评估。Associativity is a term from mathematics, and is a property of an operator. An operator
o
is said to be associative if, for alla
,b
, andc
,(a o b) o c = a o (b o c)
and thus, as a consequence, the expression
a o b o c
does not need parentheses to be unambiguous.For example, the addition operator
+
is associative over the integers:1 + 2 + 3
has the same value no matter which order we evaluate the+
s in. But the subtraction operator-
is not:1 - 2 - 3
means two different things, depending on which-
we evaluate first.用英语来说,这意味着您拥有一个围绕这样的概念设计的系统:您的应用程序可以在任何给定时间处于有限数量的“状态”。一个实际的例子是您正在“玩”或“暂停”的游戏或“开”或“关”的汽车。这两个状态是互斥的,并且存在 FSM 来管理当前状态。一般来说,FSM 不仅仅是一个对象或类,而是一种整体架构设计,其中应用程序中的所有操作都基于特定状态。
In English that means that you have a system designed around the concept that your application can be in a finite number of "states" and at any given time. A practical example would be in a game where you are "Playing" or "Paused" or a car that is "On" or "Off". The two states are mutually exclusive and an FSM exists to manage the current state. Generally speaking an FSM is not just one object or class but an overall architectural design where all operations in the application are based on a particular state.