[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parsing sub-grammars
Hello,
I'm new to this list, and I have a question with regard to SableCC,
which I am in the process of evaluating for use in a project:
Is ist possible to have sub-grammars of a given grammar and have --
in addition to the parser for the full grammar -- a parser for that
sub-grammar (i.e. which only accepts expressions of the sub-grammar),
without having to write two seperate grammar definitions and getting
duplicate node classes for the tokens/productions of the sub-grammar?
Background: We have input fields in the user interface of our
application where only certain (sub-)expressions of our language
should be accepted. To illustrate, imagine a Java interpreter where
on the one hand you can enter complete Java source files, but during
execution of such a program you may only enter Java expressions to be
evaluated by the interpreter for debugging purposes (like "watches" in
a debugger).
-- Niklas Matthies