Use existing languages in BNF with TinyPG?

≯℡__Kan透↙ 提交于 2019-12-21 05:52:57

问题


How can I use these BNF grammars which are in GOLD meta-syntax (RegExp + BNF) with TinyPG? I'm new to BNF so approximately what sort of conversion will I have to do to convert BNF to EBNF?

I believe it should be pretty simple since TinyPG needs RegExp + EBNF in comparison to the GOLD grammars which are RegExp + BNF.

Also, is there any TinyPG source code for any language available, just to see what sort of conversion I would have to do?


回答1:


EBNF is not entirely backwards compatible with BNF, however the differences are actually slight, you should be familiar with the document at

http://www.cs.cmu.edu/~pattis/misc/ebnf.pdf

Primarily you have to handle the special characters <>|:= (enclosed in double quotes).

You could just use the GOLD meta-syntax engine to output your parser if it can be in one of the supported languages - instead of using TinyPG...

It begs the question - What language will your parser be in when you are implementing it?



来源:https://stackoverflow.com/questions/321245/use-existing-languages-in-bnf-with-tinypg

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