问题
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:
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.
来源:https://stackoverflow.com/questions/11988016/can-a-antlr-grammar-file-be-modified-to-be-used-by-ply