Or, to be a little more precise: which programming languages are defined by a context-free grammar?
From what I gather C++ is not context-free due to things like mac
VHDL is somewhat context sensitive:
VHDL is context-sensitive in a mean way. Consider this statement inside a process:
jinx := foo(1);Well, depending on the objects defined in the scope of the process (and its enclosing scopes), this can be either:
- A function call
- Indexing an array
- Indexing an array returned by a parameter-less function call
To parse this correctly, a parser has to carry a hierarchical symbol table (with enclosing scopes), and the current file isn't even enough.
foocan be a function defined in a package. So the parser should first analyze the packages imported by the file it's parsing, and figure out the symbols defined in them.This is just an example. The VHDL type/subtype system is a similarly context-sensitive mess that's very difficult to parse.
(Eli Bendersky, “Parsing VHDL is [very] hard”, 2009)