Writing a simple parser

北战南征 提交于 2019-12-04 17:35:17

问题


I need to write a simple parser to a sort of Domain Specific Language.
It needs to have basic arithmatics with proper operators evaluation order and a syntax to call functions of the underlying environment which can be overloaded.
What is the simplest way to write such a parser? Is there something I can adapt or use out of the box? I'm writing in C++.


回答1:


Take a look at Boost Spirit.




回答2:


See MetaII parser technology. This tutorial walks you through everything:

http://www.bayfronttechnologies.com/mc_tutorial.html




回答3:


ANTLR will help you a lot.




回答4:


I used Ragel parse some data. It worked pretty well for me.



来源:https://stackoverflow.com/questions/788814/writing-a-simple-parser

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