Handling the typedef problem with a modifiable grammar

bburshte@pyrps5.eng.pyramid.com (Boris Burshteyn)
Thu, 9 Jan 92 10:33:28 -0800

          From comp.compilers

Related articles
Lookahead vs. Scanner Feedback hjelm+@cs.cmu.edu (1992-01-03)
Handling the typedef problem with a modifiable grammar bburshte@pyrps5.eng.pyramid.com (1992-01-09)
Handling the typedef problem with a modifiable grammar bevan@computer-science.manchester.ac.uk (Stephen J Bevan) (1992-01-13)
Programming language syntax design (was Re: ... typedef problem) landauer@morocco.Eng.Sun.COM (1992-01-14)
Parsing C typedefs drw@math.mit.edu (1992-01-15)
Re: Programming language syntax design (was Re: ... typedef problem) anw@maths.nott.ac.uk (1992-01-17)
Re: Programming language syntax design (was Re: ... typedef problem) bliss@sp64.csrd.uiuc.edu (1992-01-20)
| List of all articles for this month |

Newsgroups: comp.compilers
From: bburshte@pyrps5.eng.pyramid.com (Boris Burshteyn)
Keywords: parse, C
Organization: Compilers Central
References: 92-01-012
Date: Thu, 9 Jan 92 10:33:28 -0800

This message regards typedef names recognition problem. It can be solved
in the modifiable gramars approach. Modifiable grammars allow to
add/delete rules from the basic set of rules while scanning the source
text. When reducing statement


typedef int foo;


a new rule


int : foo; // 1


will be introduced together with the new terminal 'foo'. Also, the basic
set of rules should contain a rule looking something like


declaration : int lis_of_identifiers ';' ; // 2


list_of_identifiers : identifier // 3
| list_of_identifiers ',' identifier // 4


Then, the text


foo var;


will be reduced by the sequence of rules 1, 3, 2. The example presented
does not address issues of scope, i.e. what happens when typedefs are
redefined in the inner scope and then become visible again upon exiting
the scope. This relates to the way new rules are added/deleted to/from
the basic set. I have submitted to SIGPLAN NOTICES a description of a
metalanguage for the USSA system, based on this approach. The
metalanguage is powerful enoupgh to handle various scenarious of rules
modification, so that solutions to visibility and scope problems may be
expressed.


There are also papers printed in SIGPLAN NOTICES, regarding this approach:


Henning Christiansen. "A Survey of Adaptable Grammars," Sigplan Notices,
V.25 N.11, 35-44, 1990.


Boris Burshteyn. "On the Modification of the Formal Grammar at Parse
Time," Sigplan notices, V.25 N.5, 117-123, 1990.


Boris Burshteyn. "Generation and Recognition of Formal Languages by
Modifiable Grammars," Sigplan Notices, V.25 N.12, 45-53, 1990.


Thanks, Boris Burshteyn - a man who can spell 'automaton'.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.