Can a ANTLR grammar file be modified to be used by

2019-06-08 01:25发布

I want to make a python program that uses PLY to parse Javascript files, I din't found any sources of parsers that implement the ECMAScript, Javascript rules that use PLY.

The only thing I found was some ANTLR grammar files to parse javascript and ecmascript: http://www.antlr.org/grammar/1153976512034/ecmascriptA3.g http://www.antlr.org/grammar/1206736738015/JavaScript.g

Can ANTLR grammar files be adapted to be used as PLY rules, if yes, how can be done in a semi-automatic way, do I need to parse the grammar files? Is there another workaround this (i.e. than using ANTLR grammar files)?

1条回答
狗以群分
2楼-- · 2019-06-08 01:57

Can ANTLR grammar files be adapted to be used as PLY rules, [...] ?

No, they can't. PLY generates LALR parsers while ANTLR generates LL ones. Their input grammars are too different for a trivial (or automated) conversion.

查看更多
登录 后发表回答