News for hackers. Stuff that matters.
Re:The naked truth about writing a programming language (2014) by signaru on Sunday May 03, 2020 @03:33AM (#23057488)
In BASIC the equal symbol "=" can mean assignment or equality depending on "context". Is this an example of a non context free?

On the other hand, I've seen EBNF definition of BASIC (VB, actually). Is this a contradiction?

(just someone still learning)

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>
Re:The naked truth about writing a programming language (2014) by foldr on Sunday May 03, 2020 @04:38AM (#23057745)
A context free grammar can handle this fine - as you can see from the EBNF - so no, it's not an example.