Hi all,
I am looking for a clean ANTLR way to parse a language which is embedded in
another language. Let's assume that we have parser for a language which
enables name aliasing. The syntax for such operation is:
ID ALIAS "alias"

Also, there are slightly different rules governing aliases, they can be more
than ordinary identifiers, for example:
distance alias "|-|" ( where |-| is not a valid identifier)

So, clearly, I have to write another parser/lexer for this "alias language",
which I did actually; to avoid breaking DRY rule I made it dependent on
"main" lexer and so on - and that is fine.

So, under conditions I described above, what is the best way to operate this
'slave' parser. I'd like to: start the other parser in appropriate rule
(probably an action) so that it parser next input. If 'slave' reports syntax
error, I'd like to have it propagated to the main parser client. If slave
thinks that alias syntax is ok, then let it emit the appropriate token and
pass the control back to the main parser which then resumes scanning where
'slave' has left. I appreciate hearing about your ideas. Thanks.




-- 
Greetings
Marcin Rzeźnicki

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to