Grammar Writing Tools [closed]

只谈情不闲聊 提交于 2019-12-02 23:47:59

Taking Steven Dee's suggestion one step further, you might want to check out ANTLRWorks, which is an interactive GUI development tool for ANTLR grammars.

Use TinyPG! Its an amazing all-in-one compiler compiler with a lightweight GUI, where you build your parser with RegEx, EBNF, and write C#/VB code to do something with the parse tree!

Here's a short and informative summary that I did earlier, which also links you to the downloads.


My understandings of TinyPG:

TinyPG allows you to write & develop:

It has an in-built IDE, Windows Only (created in C#.NET, open source).

It allows you to try out & preview Regular Expressions using the inbuilt RegEx tool. RegEx syntax is supported in .NET which means that even your outputted parser code uses .NET's Regular Expressions.

You write EBNF to describe the language of your choice (Here are some freely available BNF Grammers that describe modern programming languages (C, Java, JavaScript, C#, VB.NET, SQL-89)

Using TinyPG, your RegEx along with your EBNF outputs a parse-tree (see this diagram).

Now what do you do with the parse-tree? You write C#/VB code (within TinyPG, per BNF grammer rule) for your Compiler/Interpreter/Translator. (inside TinyPG, open the "simple expression2.tpg" file within the provided Samples to see a demo of a calculator 'compiler')

TinyPG allows you to Compile and Test your tokenizer+parser+complier, within the TinyPG IDE, and it finally outputs the parser source code in C#.NET or VB.NET (your choice), with ready-to-use classes.

An excellent All-in-one Compiler Compiler for the masses. Enjoy!

PS: Correct me if I'm wrong on any of this.

To check whether a grammar allows a certain parser algorithm, just put it into the parser generator. In case of LALR(1), pass the grammar to YACC to see whether it detects conflicts.

CoCo/R C# is missing from the list. It is simple to use, very versatile and especially useful has code generators for a great variety of languages

Coco/R for C#, Java, C++, F#, VB.Net, Oberon, other languages

[1] http://www.ssw.uni-linz.ac.at/Coco/

ANTLR is a GUI parser generator in Java that has extensive capabilities for grammar analysis and factoring. Check the FAQ; it might support what you're looking for.

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