please help with lisp grammar! 
Author Message
 please help with lisp grammar!

Hello,

I am a student and I am taking an introductory course on
programming languages..Currently my class is in the Lisp
chapter..Lisp as a language has its own grammar..We use
the BNF grammar for Lisp...However a section of BNF grammar
that describes the language constructs is not clear to me..

note the following BNF def section for LISP:

value----> integer | quoted-constant

value-op---> + | - | / | > | > | cons | car | cdr
             number? | symbol? | list? | null? | print

quoted-constant----> 'S-expression

S-expression----> integer | symbol | (S-expression*)

symbol----> name

|=this symbol means or
---->=this symbol means "is defined to be"

A value in Lisp can be only an integer or a quoted-constant
a quoted constant can be an S-expression that it has in front
of it the ' char
Now assume you want to parse the following line using bottom up

'('15 apple)
trying parsing this is hard cause of the grammar above.
Note the book we are using is called..
PROGRAMMING LANGUAGES
AN INTERPRETER-BASED APPROACH
Author: Samuel N. Kamin
Publisher: addison wesley
...
the quoted S-expression makes things difficult

Thank you alot,
Constantine  

Thank you alot,
Constantine  

Constantine  

--
*******************************************************************

*"HELLAS=Science,Arts,Civilization,Democracy"                     *
*******************************************************************



Wed, 07 Aug 1996 01:02:55 GMT  
 please help with lisp grammar!

Quote:
>value----> integer | quoted-constant

>value-op---> + | - | / | > | > | cons | car | cdr
>             number? | symbol? | list? | null? | print

the value-op non-terminal isn't mentioned in any production.

Quote:
>quoted-constant----> 'S-expression

>S-expression----> integer | symbol | (S-expression*)

>symbol----> name

The name non-terminal isn't defined in your grammar.  Should this be
value-op?  All your value-ops are symbols.

Quote:
>Now assume you want to parse the following line using bottom up

>'('15 apple)
>trying parsing this is hard cause of the grammar above.

Your grammar is for a very limited subset of Lisp, and according to that
grammar the above line is invalid, since it doesn't include quoted
constants as parts of s-expressions.

In real Lisps, 's-expression is simply a shorthand for (quote
s-expression), so the grammar only needs to worry about the latter.
--
Barry Margolin
System Manager, Thinking Machines Corp.




Wed, 07 Aug 1996 13:05:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. please, please, please, please, help

2. will someone please, please, please, please HELP me?!!

3. help me please, lisp or vasic programming

4. help me with lisp please

5. Total Lisp Novice Needs Help, Please...

6. Please help with docs about LISP !!!

7. Please help common lisp

8. Please help , lisp to microstation thanks

9. Lisp Help Please?

10. C structures in LISP - HELP PLEASE

11. Lisp Help Please

12. please help to making a lisp running !!

 

 
Powered by phpBB® Forum Software