Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

PEGs and all the other lexerless approaches allow to mix any kind of grammars. See Katahdin for an inspiration.

share|improve this answer
Linked from the Katahdin page, there is The Packrat Parsing and Parsing Expression Grammars Page that is very interesting. Thanks. – Seki Jul 19 '12 at 11:54
@Seki, you may also find this example interesting: – SK-logic Jul 19 '12 at 12:09
it is interesting indeed. BTW you should not have used an url shortener: the actual url PFront: a language with extensible syntax is better to know what it is about. – Seki Aug 7 '12 at 10:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.