[antlr-interest] "An Introduction to ANTLR" presentation slides

Andy Tripp antlr at jazillian.com
Thu Feb 28 10:39:44 PST 2008


Matt Benson wrote:
>
> I don't think it's correct to say that a syntactic
> predicate is a type of semantic predicate.  I think
> the nomenclature here directly reflects the difference
> between syntax and semantics:  respectively, the
> legality of the communication medium vs. the
> sensicality (?) of the content.
I don't think that's right. When we have a syntactic predicate:
(X) => Y
...it's not saying anything about the legality of the input nor
whether X is semantically legal.

With the traditional case of just a lexer and a parser, syntax is
"how does the input characters sequence map to a Token stream?"
And semantics is "how does the input Token stream map to an AST"?

Terrence has this general mechanism that he's calling "predicates"
which checks the structure of the input. That input can be a stream
of characters (for lexer), tokens (for parser), or ASTs for treewalker.

Now that I think about it, maybe a better name for "syntactic predicate"
would be "input pattern predicate" or something like that. The term
"syntactic", to me, is a bit misleading because it makes
me think of input characters.

Saying "my treewalker has a
syntactic predicate, which of course checks the shape of the input
AST" seems a bit odd. I may just be stuck in an old way of thinking,
but I just checked dictionary.com and wikipedia, and they're agreeing
with me :)

Andy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080228/133646a4/attachment.html 


More information about the antlr-interest mailing list