Re: Object-oriented compiler construction: ideas?

"Malcolm Crowe" <Malcolm_Crowe@msn.com>
8 Jun 1996 16:31:45 -0400

          From comp.compilers

Related articles
Object-oriented compiler construction: ideas? op@esec.ch (Oliver Plohmann) (1996-06-01)
Re: Object-oriented compiler construction: ideas? Malcolm_Crowe@msn.com (Malcolm Crowe) (1996-06-08)
Re: Object-oriented compiler construction: ideas? Arthur.Chance@Smallworld.co.uk (1996-06-08)
Re: Object-oriented compiler construction: ideas? dotw@centauri.cadre.nl (1996-06-08)
Re: Object-oriented compiler construction: ideas? bnm@indica.bbt.com (1996-06-08)
Re: Object-oriented compiler construction: ideas? nick@an-teallach.com (Nick Rothwell) (1996-06-08)
Re: Object-oriented compiler construction: ideas? darius@phidani.be (Darius Blasbans) (1996-06-08)
Re: Object-oriented compiler construction: ideas? poe@theory.lcs.mit.edu (1996-06-13)
[15 later articles]
| List of all articles for this month |

From: "Malcolm Crowe" <Malcolm_Crowe@msn.com>
Newsgroups: comp.compilers
Date: 8 Jun 1996 16:31:45 -0400
Organization: CompuServe Incorporated
References: 96-06-010
Keywords: OOP

Oliver Plohmann <op@esec.ch> wrote
> When I first looked into a book about compilers I saw a parse tree with
> integers representing the respective keyword. I thought you could
> alternatively make up the parse tree of objects, like Statement,
> ConditionalBlock, Loop, etc. A ConditionalBlock would contain the
> condition and the respective code to be executed. Then you could put the
> knowledge of how the assembler code would look like for
> aConditionalBlock into that class. Same with the other classes to
> distribute responsabilities among objects to reduce complexity. This
> would also greatly reduce the amount of case switches.


I've developed lex and yacc-like tools that implement the idea you
describe. The tools are written in C++
(using the Microsoft Foundation Classes) and generate C++ in such a way
that the default action for a grammar symbol Statement (say) is to create
a Statement object, and you can invent your own attributes for these
objects, which form a hierarchy.


An early version is available for anonyonus FTP from
ftp://ftp.paisley.ac.uk/pub/mkc/toolszip.uue


If you're interested e-mail me and I'll send you the current version (yes,
I'll publish it properly in a few weeks). The new version also has
lex-style REJECT action and error recovery in the parser.


Malcolm Crowe
University of Paisley
mkc@paisley.ac.uk
Malcolm_Crowe@msn.com
100127.116@compuserve.com
--


Post a followup to this message

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