开发者

Which programming languages have a regular grammar?

开发者 https://www.devze.com 2023-02-24 00:04 出处:网络
I\'m curious about which (if any) real-world programming languages have a regular grammar (i.e. the set of all syntactically correct programs is regular).

I'm curious about which (if any) real-world programming languages have a regular grammar (i.e. the set of all syntactically correct programs is regular).

See also this question:开发者_Python百科 What programming languages are context-free?.


Brainfuck and Whitespace and similars are certainly regular.

On the other side, any language that supports (parens) is not regular, as the automaton recognizing it would need a stack. And I don't really know many languages without (){}[] support that would do anything more than assembly.

Only real-worldy example that comes to mind and probably is regular is Forth.

0

精彩评论

暂无评论...
验证码 换一张
取 消