在TinyPG中使用BNF中的现有语言吗? [英] Use existing languages in BNF with TinyPG?

查看:98
本文介绍了在TinyPG中使用BNF中的现有语言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用这些BNF语法 ="http://www.devincook.com/GOLDParser/doc/meta-language/index.htm" rel ="nofollow noreferrer">使用TinyPG的GOLD元语法(RegExp + BNF)?我是BNF的新手,那么大约需要什么类型的转换才能将BNF转换为EBNF?

我相信它应该非常简单,因为与Greg语法RegExp + BNF 相比,TinyPG需要RegExp + EBNF .

还有,TinyPG的源代码是否适用于任何语言,只是看我将要进行哪种转换?

解决方案

EBNF不能与BNF完全向下兼容,但是实际上差异很小,您应该熟悉该文档

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

首先,您必须处理特殊字符<> |:=(用双引号引起来).

如果解析器可以使用一种受支持的语言,则可以仅使用GOLD元语法引擎输出解析器-而不是使用TinyPG ...

这引出了一个问题-解析器实现时将使用哪种语言?

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?

解决方案

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?

这篇关于在TinyPG中使用BNF中的现有语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆