简体   繁体   中英

Which programming language has very short context-free Grammar in its formal specification?

What programming language has short and beautiful grammars (in EBNF)?

Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful but it is not very short.

I suggest that many functional programming languages like LISP have short simple grammars, but I am interested in a more popular simple imperative language like C or Bash.

I haven't compared, but Lua is a language renowned for its simple syntax. The BNF is at the very end of this reference manual: http://www.lua.org/manual/5.1/manual.html .

Assembly languages!

...in general, and particularly for CPUs which have a simple architecture (few instructions, few addressing modes, few registers) have a relatively short grammar.

In fact, specialized processors, such as these found in programmable logic controllers can have a language with even simpler grammars. But then again the most simple of the PLCs are little more than Boolean equation calculators.

One of the simplest imperative languages is Oberon-2. Syntax of Oberon-2 .

Also take a look at Oberon-07 ( The Programming Language Oberon-07, PDF ) and Component Pascal .

Pascal只有2-3页的BNF表示法

What about GL Shading language? Language Specification (PDF)

However for these kind of hobbies I always preferred to implement a subset of a known language by myself without choosing anything "premade"..

Lisp可能很小。

lisp ::= `(´ exp `)´

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM