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

Andy Tripp antlr at jazillian.com
Fri Feb 29 09:42:13 PST 2008


Guess I'm not being clear. Let me start again, logically:

1) lexers, parsers, and treewalkers can all have "syntactic predicates" 
(from ANTLR book)
2) You're applying a derivative of the word "syntax" to lexers, parsers, 
and treewalkers (from 1)
3) "Syntactic predicates" are constructs that match patterns in the 
input (from ANTLR book)
   - for a lexer, they match input chars
   - for a parser, they match input token sequences
   - for a treewalker, they match input AST structures
4) Common use of the term "syntax" only applies to parsers, not to 
lexers and not to treewalkers (I'm making this assertion)
   - when a lexer encounters an invalid input char, people don't say 
"it's bad syntax", we say "invalid character"
   - when a parser encounters an invalid input token sequence, we do 
call it "bad syntax"
   - when a treewalker encounters an invalid input AST, we don't say 
"it's bad syntax" we say "invalid AST"
5) Because the term "syntax" is has a common meaning (roughly "invalid 
sequence of tokens to a parser),
    that term (or any derivative) should not be used to mean something 
different. Item 4 above shows what "syntax"
    means, and item 3 above shows what "syntactic predicates" are used for.

Andy


More information about the antlr-interest mailing list