EBNF or BNF for the LOGO programming language

…衆ロ難τιáo~ 提交于 2019-12-20 12:22:06

问题


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


回答1:


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

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

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

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.




回答2:


There is no standard LOGO implementation.

Your best call is probably to look at the source of a popular implementation, such as UCBLogo



来源:https://stackoverflow.com/questions/6819505/ebnf-or-bnf-for-the-logo-programming-language

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