I am currently writing a grammar for a programming language (PowerBuilder) and I am also collecting documentation about parsing and compilers creation.
Now I would like to add in my grammar (that looks roughly like Visual Basic) the possibility to handle embedded SQL statements that are supported inline by the language (with the usage of binding variables like select foo into :ls_bar from baz where col=:ls_criteria;
). As the embedded SQL is regular SQL syntax, I would not complexify my existing grammar but instead adapt an existing SQL-92 grammar to my needs and use it on these SQL blocks.
The parser generator that I am mainly using (AntLR) has some possibilities to support mixed or “island” grammars as described in that article or another.
I would like to compare these techniques with AntLR with others tools like Lex/Yacc, Flex, JFlex, that I used while playing with several simple language designs described in different CS courses available online.
Could you point me to examples of implementations of parsers that support mixed grammars?
PEGs and all the other lexerless approaches allow to mix any kind of grammars. See Katahdin for an inspiration.
3