Re:The naked truth about writing a programming language (2014)
by kyllo on Sunday May 03, 2020 @06:17PM
(#23062325)
It's still context-free, the reason is because by the time you hit the '=' symbol you already know whether you're in a <Statement> or a <Compare Exp> production rule, based on the preceding symbols (namely the LET keyword), based on these excerpts from the BASIC EBNF:
<Statement> ::= CLOSE '#' Integer
| DATA <Constant List>
[...]
| LET Id '=' <Expression>
[...]
| Remark
<Compare Exp> ::= <Add Exp> '=' <Compare Exp>
| <Add Exp> '<>' <Compare Exp>
| <Add Exp> '><' <Compare Exp>
| <Add Exp> '>' <Compare Exp>
| <Add Exp> '>=' <Compare Exp>
| <Add Exp> '<' <Compare Exp>
| <Add Exp> '<=' <Compare Exp>
| <Add Exp>
On the other hand, I've seen EBNF definition of BASIC (VB, actually). Is this a contradiction?
(just someone still learning)