EBNF或BNF用于LOGO编程语言 [英] EBNF or BNF for the LOGO programming language

查看:97
本文介绍了EBNF或BNF用于LOGO编程语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在哪里可以获取 LOGO 编程语言的BNF或EBNF吗?

Does anyone know where I can get the BNF or EBNF for the LOGO programming language?

推荐答案

BNF语法在某些情况下可能不太有用...

A BNF grammar might not be too useful in certain circumstances...

写一个与现有/历史实现精确兼容的LOGO并非易事(我从事过这样的项目).问题在于解析器无法完成全部工作,而评估器(解释器)必须处理部分数据.考虑以下示例:

Writing a LOGO that's accurately compatible with existing/historical implementation isn't an easy task (I worked on such a project). The problem is that the parser doesn't do the full job, and the evaluator (interpreter) has to work with partial data. Consider this example:

proc1 a b proc2 c

根据proc1和amp1的参数数量,它可能表示proc1(a,b,proc2(c))或proc1(a,b,proc2(),c). proc2.

It could mean proc1(a, b, proc2(c)) or proc1(a, b, proc2(), c) according to the number of parameters for proc1 & proc2.

此外,我所知道的LOGO解释器(例如Berkely LOGO)从粗略的眼神看来,似乎并没有写一个传统的解析器,该解析器还可以访问每个过程及其Arity.相反,它们运行过程,并且过程消耗"了所需的参数数量.这使得解析器有点天真,并且主要角色是解释器,因此解析是不寻常的.

Furthermore the LOGO interpreters I know, for example Berkely LOGO, seem from a cursory glance not to write a traditional parser that additionally has access to each procedure and its arity; instead they run the procedures and the procedures 'eat up' the number of parameters that they need. This makes the parser a little naive and the main role is that of an interpreter, and thus parsing is kind of unusual.

这篇关于EBNF或BNF用于LOGO编程语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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