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

Loring Craymer lgcraymer at yahoo.com
Mon Mar 3 16:10:06 PST 2008


As the noted logician Charles Lutwidge Dodgson wrote
March Hare: …Then you should say what you mean. 
Alice: I do; at least - at least I mean what I say -- that's the same thing, you know.
Hatter: Not the same thing a bit! Why, you might just as well say that, 'I see what I eat' is the same as 'I eat what I see'!
March Hare: You might just as well say, that "I like what I get" is the same thing as "I get what I like"! 
The Dormouse: You might just as well say, that "I breathe when I sleep" is the same thing as "I sleep when I breathe"!

The same lexer that got you 'cat' will get you 'chat'.  What meaning would you give that?  Now suppose the sentence was "Viva la chat!".  Would your interpretation change?

Lexers understand the character syntax from which words are built, not the semantics of the words.

--Loring

----- Original Message ----
From: Andy Tripp <antlr at jazillian.com>
To: Guntis Ozols <guntiso at latnet.lv>
Cc: antlr-interest <antlr-interest at antlr.org>; Terence Parr <parrt at cs.usfca.edu>
Sent: Monday, March 3, 2008 3:02:40 PM
Subject: Re: [antlr-interest] "An Introduction to ANTLR" presentation slides

  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 happensto 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". Alexer 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 seeingthat semantics is just one type
of meaning. A pretty printer that lexes, parses, and treewalks, andprints out the input in some nice
format may do no semantic analysis. But it "knows the meaning" of astatement, or else it wouldn't
be able to do it's job (say, follow every statement with a ";").






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080303/6beb5a2c/attachment-0001.html 


More information about the antlr-interest mailing list