[antlr-interest] "An Introduction to ANTLR" presentation slides
Andy Tripp
antlr at jazillian.com
Mon Mar 3 15:02:40 PST 2008
Guntis Ozols wrote:
>> A lexer takes letters 'c', 'a', and 't' as input and outputs the word "cat".
>> If the word "cat" isn't the "meaning" of those letters, then I'm
>> completely lost.
>>
>
> Lost, of course...
> Just letters, just words, just sentences, stream or tree or whatever...
> These are not the "meaning" yet.
>
> See http://en.wikipedia.org/wiki/Cat for a description of "cat"
> to understand the meaning of "cat".
>
>
No, it's not a real cat that I'm talking about here, obviously.
I'm talking about a Token that's part of a lexer output, which happens
to have a text string associated
with it of "cat".
Ask a person what is the meaning of the letters 'c', 'a', and 't'
(presumably in that order and surrounded by
non-letters), and they'll tell you the meaning is the word "cat". A
lexer does the same: produces
a meaningful output that represents the meaning of the input.
A lexer (or any recognizer) certainly knows and applies "meaning".
I think people are equating "meaning" to semantics instead of seeing
that semantics is just one type
of meaning. A pretty printer that lexes, parses, and treewalks, and
prints out the input in some nice
format may do no semantic analysis. But it "knows the meaning" of a
statement, or else it wouldn't
be able to do it's job (say, follow every statement with a ";").
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080303/822ede75/attachment.html
More information about the antlr-interest
mailing list