语法写作工具

发布于 2024-07-08 13:32:36 字数 1557 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

长安忆 2024-07-15 13:32:36

使用TinyPG! 它是一款令人惊叹的一体化编译器,具有轻量级 GUI,您可以在其中使用 RegExEBNF 构建解析器,并编写 >C#/VB 代码来使用解析树做一些事情!

这是我之前所做的简短而内容丰富的摘要,其中还提供了下载链接。


我对TinyPG的理解:

TinyPG< /a> 允许你写 & 开发:

它有一个内置 IDE,仅限 Windows(用 C#.NET 创建,开源)

它允许您尝试和使用 使用内置的 RegEx 工具预览正则表达式 .NET 支持 RegEx 语法,这意味着即使您的输出的解析器代码也使用 .NET 的正则表达式。

您编写 EBNF 来描述您选择的语言 (这里有一些免费提供的描述现代编程语言的 BNF 语法(C、Java、JavaScript、C#、VB.NET、SQL-89)

使用 TinyPG,您的 RegEx你的EBNF输出一个解析树(参见此图)

现在您如何编写C#/VB 代码(在 TinyPG 内,按照 BNF 语法规则) 用于您的编译器/解释器/翻译器。 (在 TinyPG 内,打开提供的示例中的“simple expression2.tpg”文件以查看计算器“编译器”演示)

TinyPG 允许您在 TinyPG 中编译和测试您的标记器+解析器+编译器 IDE,最终输出 C#.NET 或 VB.NET 中的解析器源代码(您的选择)立即可用类。

一款面向大众的优秀一体化编译器。 享受!

PS:如果我在这方面有任何错误,请纠正我。

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.

岁月静好 2024-07-15 13:32:36

进一步采纳 Steven Dee 的建议,您可能需要查看 ANTLRWorks,它是ANTLR 语法的交互式 GUI 开发工具。

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.

丢了幸福的猪 2024-07-15 13:32:36

要检查语法是否允许某种解析器算法,只需将其放入解析器生成器中即可。 对于 LALR(1),将语法传递给 YACC 以查看它是否检测到冲突。

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.

◇流星雨 2024-07-15 13:32:36

列表中缺少 CoCo/R C#。 它使用简单,用途广泛,特别有用,具有适用于多种语言的代码生成器

Coco/R,适用于 C#、Java、C++、F#、VB.Net、Oberon 和其他语言

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

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/

只等公子 2024-07-15 13:32:36

ANTLR 是 Java 中的 GUI 解析器生成器,具有广泛的语法分析和因子分解功能。 查看常见问题解答; 它可能支持您正在寻找的内容。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文