Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Modula 3 > Modula-3 gramma...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 105 of 148
Post > Topic >>

Modula-3 grammar ambiguity (a puzzle)

by dragisha@[EMAIL PROTECTED] (Dragi?a Duri&#263;) Nov 29, 2004 at 10:52 PM

I am writing a parser for Modula-3 and this production puzzled me:

ObjectType    = [TypeName | ObjectType] [Brand] OBJECT Fields 
                 [METHODS Methods] [OVERRIDES Overrides] END.

This rule is single left recursive piece of Modula-3 grammar, IIRC.
And also, it does not look correct - I can't remember I've seen
anything except "TypeName" (meaning "qualId | [UNTRACED] ROOT")
denoting parent type anywhere in Modula-3 sources. It is also
illogical (to me, at least) to have anonymous type as parent of
anything, and we will have that if this is declared:

TYPE
  My = OBJECT a: CARDINAL; END OBJECT b: CARDINAL; END;

This "My" is in proper syntax according to above production, but pm3
did not accept it. I have no reason to believe any Modula-3 compiler
will. Is there a reason? Do we have an ommision in Modula-3 syntax or
implementation restriction in our compilers?

TIA,
dd




 2 Posts in Topic:
Modula-3 grammar ambiguity (a puzzle)
dragisha@[EMAIL PROTECTED  2004-11-29 22:52:35 
Re: Modula-3 grammar ambiguity (a puzzle)
Olaf Wagner <wagner@[E  2004-12-01 07:05:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 0:36:49 CDT 2008.