English 中文(简体)
ANTLR grammar: parser- and lexerlich
原标题:ANTLR grammar: parser- and lexer literals

这一图表之间的区别:

...
if_statement :  if  condition  then  statement  else  statement  end_if ;
... 

为此:

...
if_statement : IF condition THEN statement ELSE statement END_IF;
...

IF :  if ;
THEN:  then ;
ELSE:  else ;
END_IF:  end_if ;
....

?

If there is any difference, as this impacts on performance ... Thanks

问题回答

除了回答外,最好明确地界定你的弹性标记(在你的弹性图表中)。 如果你把他们重新归为你的教区,那么在什么顺序上,这并不总是清楚的。 在明确定义时,他们总是按照他们被置于法尔语(从上到下)的顺序重塑。

最大的区别可能与你无关。 如果你的Lexer规则处于灵活性之中,那么你就可以利用继承来分享一套共同的灵活规则。

如果你在座右铭规则中只使用str子,你就不能这样做。 如果你从未计划重新使用你的法尔法,那么这一优势就没有问题了。

此外,我和我猜测大多数 Antlr veterans, 更习惯于在实际弹性体法中找到更灵活的规则,而不是与比法尔法混为一谈,因此,人们可以认为,通过将规则放在弹性法中来增加可读性。

在安特尔教区为这两种办法建造后,不会产生任何时间的绩效影响。

唯一的区别是,在您的第一生产规则中,关键词的定义是含蓄的。 含蓄地界定的标注不意味着时间上的业绩。

还有一个区别:当你明确界定你的弹性规则时,你可以通过你给他们的名称(例如,当你需要检查某个特定症状类型时)查阅这些规则。 否则,《南极海生公约》将使用任意编号(有预设)。





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes ...

XML DOM parsing br tag

I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...

Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

Locating specific string and capturing data following it

I built a site a long time ago and now I want to place the data into a database without copying and pasting the 400+ pages that it has grown to so that I can make the site database driven. My site ...

热门标签