The concept of "semantic predicates" is explained very well in the antlr
litterature. (I bought "the antlr reference 3.0" to better understand
the parser technology on which Xtext stands).
Basically, "semantic predicate" means that if the parser is in a state
where several predictions are valid (i.e. there is ambiguity), a
semantic predicate (a rule) can specify that it should pick a particular
prediction (~ way to parse).
In order to benefit from semantic predicates you would need to be
dealing with a very complex language where for instance parsing needs to
be guided by types of thing already seen (the C language is such a
There are many options when using Xtext - using relaxed parsing and an
"anemic" model where you handle the more complex parts of your language
in validation or linking, or indeed in a second m2m transformation.
Why do you think you need "semantic predicates" ?
There is most likely a different solution to your problem (unless you
need to deal with a language such as C - a language which by the way
there is lots of articles to google for that describes the difficulties
parsing it. Hint: even if you are not writing a C parser, it is good to
know what royally screws up parsing, and thus are language constructs
that you want to avoid. That is if you have any say in the design of the
language you are writing a parser for).
On 1/11/11 11:33 PM, Maria wrote:
> I have read in a website: http://eclipse.dzone.com/articles/xtext that
> in Xtext, it is difficult to implement semantic predicates. What do we
> mean by this? Have you concreate examples?