English 中文(简体)
是否需要哪类 par子?
原标题:What type of parser is needed for this grammar?

我有一张图表,我不知道我需要哪一类教区才能使其与我不认为克法是LL(1)。 我认为,我需要一个有背轨的教区或某种类型的L(*)。 我提出的图表是:

S: Rules
Rules: Rule | Rule Rules
Rule: id  =  Ids
Ids: id | Ids id

我试图用什么语言来研究:

abc = def g hi jk lm
xy = aaa bbb ccc ddd eee fff jjj kkk
foo = bar ha ha 

零或以上 载有左识别标志的规则,随后是一个或多个身份识别器。 我认为,我会提出一个问题,即:图表法允许任何数额的补贴,而新规则的开端是它发现的“id = ,需要背后。

是否有任何人了解这种语法的分类和教区的最佳方法,即:hand written parser?

最佳回答

生成识别标志的图表,随后是平等标志,随后是确定识别特征的序列。 这意味着,可以用家庭津贴或定期表达方式对语言进行扼杀。 不需要定型或L(*)等值。

To see that the language is regular, let Id = U {a : a ∈ Γ}, where Γ ⊂ Σ is the set of symbols that can occur in identifiers. The language you are trying to generate is denoted by the regular expression

  • Id+ =( Id+)* Id+

Setting ={<>a>,b, ......,z}, 经常表述的文字示例:

  • look = i am in a regular language
  • hey = that means i can be recognized by a dfa
  • cool = or even a regular expression

没有必要利用强大的教区技术来调和你的语言。 一种情况是,使用定期表述或每日生活津贴进行区分是适当和最佳的。

<<>strong>edit:

代表以上定期发言R。 To parse R<>*, produced a DFA identifying the Language of R*. 为此,利用从Kleene stheorem获得的算法,形成一种承认R*语言的全国投资基金。 然后,利用次构造将《国家食品法》转化为《食品法》。 由此得出的数字将在R*上标明。 鉴于所建的《家庭津贴法》在你的执行语言中有代表性,需要采取的行动,例如,

  • Add the last identifier parsed to the right-hand side of the current declaration statement being parsed
  • Add the last declaration statement parsed to a list of parsed declarations, and use the last identifier parsed to begin parsing a new declaration statement

可加入《家庭津贴法》各州。 在现实中,使用Kleene的 the子和沥青建筑可能没有必要使用这种简单的语言。 也就是说,如果不执行一个自治州,你可能只是写上上述两项行动的教区。 鉴于更复杂的常规地库(例如,方案拟订地兰热的弹性结构),转换是最佳选择。

问题回答

暂无回答




相关问题
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 ...

热门标签