Where can I find a yacc grammar for ECMAscript/Actionscript/Javascript [closed]

回眸只為那壹抹淺笑 提交于 2019-12-01 08:04:53

问题


My compilers class requires us to find a yacc grammar for one of these languages and combine it with the tokenizer we wrote. Presumably this is something easy to Google but I can't find it and my classmates are struggling as well. A yacc grammar for any of those three languages would suffice.


回答1:


This might work for you: http://www.antlr.org/grammar/1153976512034/ecmascriptA3.g




回答2:


The grammar at the bellow link uses LALR parser(see [Changelog][1]) same as Yacc, I think is much closer to what you need than ANTLR wich usees LL according to this answer: Can a ANTLR grammar file be modified to be used by PLY?

You can find the LALR Ecmascript grammar here: http://scriptonite.cvs.sourceforge.net/viewvc/scriptonite/scriptonite/src/ecmascript.grammar?revision=1.7



来源:https://stackoverflow.com/questions/7421324/where-can-i-find-a-yacc-grammar-for-ecmascript-actionscript-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!