开发者

What widespread languages are LL(k)?

开发者 https://www.devze.com 2022-12-09 15:32 出处:网络
Alrighty, by LL(k) languages, I mean programming languages whose parsers can be described by grammars which are LL(k).

Alrighty, by LL(k) languages, I mean programming languages whose parsers can be described by grammars which are LL(k).

these are my guesses:

pascal

lisp

xml and f开发者_JS百科riends


It depends on the definition of "language". If you ask

What programming language is correctly parsable with an LL(k) parser?

then none is, not even pascal or xml, since they are all context-sensitive. A context-free grammar cannot detect errors such as identifiers that are used without being defined, or match the opening and closing tag in XML. If you ask

What programming language can be conveniently parsed with an LL(k) parser, assuming that further analysis of well-formedness must be added on top of parsing?

then ANTLR is proof that nearly every programming language can be processed with a (version of an) LL(k) parser.

0

精彩评论

暂无评论...
验证码 换一张
取 消