[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsers for Programming Languages.



Matthew Estes <matt@maintree.com> skrev den Wed, 17 Sep 2003 00:35:19 -0400:

>> I'm not sure about the power vis-a-vis van Wijngaarden grammars but
>> Generalized/Tomita LR parsing is often powerful enough for parsing programming languages.
> If I understand it correctly, that can only do context-free grammars(which is more than just plain LR can do...).
>
Yes, GLR handles any context-free language.

> van Wijngaarden grammars can actually describe ANY language, but pragmatically, I would want to use it to parse context-sensitive languages, which Generalized/Tomita LR doesn't do(unless I'm thinking of the wrong thing...)
>
Ok, I misunderstood your post. GLR cannot handle
context-sensitive grammars.

> The chief value of getting context-sensitive things handled by the parser is that some things which are usually considered "semantics"(like type checking, and declaration of variables before use, etc.) can be handled in the parsing algorithm.
>
>From my experience handling type checking and def-use analysis in the parser
can give shorter/nicer grammars/descriptions/code but are more easily and faster handled by GLR plus custom code for the things you wanna check/handle. In general,
more formalism is better than less though so I wouldn't discourage from going
down that route... ;)

Regards,

Robert Feldt