News for hackers. Stuff that matters.
Re:Apple Dylan IDE (2014) by wtetzner on Sunday June 04, 2017 @07:47AM (#14480913)
Context free grammars are perfectly capable of expressing matched curly braces, even with unbounded nesting. Am I missing something?
Re:Apple Dylan IDE (2014) by dom0 on Sunday June 04, 2017 @08:58AM (#14481319)
Yes, thinking about it that alone is not sufficient. Still, I'd claim that most languages are not context free.

CPP (Pre-processor) aside, C is not context free due to typedef making identifiers ambiguous. Also if-then-else? Since C++ templates are turing-complete, the grammar is probably unrestricted.

Python is not context free due to

    if ...:
        stmt1
        if ...:
           stmt2
        stmt3
stmt3 and stmt1 have to share the same level of indentation to form a valid Python program, but they might contain arbitrary indentation within brackets.