Re: ** Grammar to describe a language and parser to parse it? **

From: Ira Baxter (idbaxter_at_semdesigns.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 00:00:12 -0600


"Honey Bee" <Anonymous-Remailer@See.Comment.Header> wrote in message
news:DXI5NOQ038052.4937152778@anonymous...
> I have this exemplary expression in prefix notation:
>
> * + x * * y z + u v w
>
> Can you see a single alphabet name? But consider that I will immediately
> generalize it to multi-contiguous-alphabet name so that space in between
> will terminate the name, not single char. Thus your grammar must cater
> explicitly to the space.

This is easily done by defining a lexer that ignores whitespace,
but terminates identifiers on whitespace or puncturation.

> Then using that grammar to write a barebone parser that is recursive. A
> translation method from grammar to parser would help.

The grammar is the same grammar you'd use for the single-letter version,
and left as a trivial exercise.

-- 
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


Relevant Pages