|info about OOP interpreter design and functions management? firstname.lastname@example.org (Gabriele Farina) (2003-08-10)|
|Re: info about OOP interpreter design and functions management? email@example.com (Isaac) (2003-08-15)|
|Re: info about OOP interpreter design and functions management? firstname.lastname@example.org (2003-08-20)|
|Re: info about OOP interpreter design and functions management? email@example.com (2003-09-01)|
|Re: info about OOP interpreter design and functions management? firstname.lastname@example.org (Gabriele Farina) (2003-09-04)|
|Date:||15 Aug 2003 23:46:22 -0400|
|Organization:||Road Runner - NC|
|Posted-Date:||15 Aug 2003 23:46:22 EDT|
> I'd like to know if there are infos on the web talking about how to
> implement an OOP syntax in an interpreted language.
> I'd like to know how I can manage class declarations and
> I got also problems with functions: can someone easilly talk to me how
> functions declarations and calling can be managed? I have to save it
> in the syntax tree? How? and how can i call them?
Are you using a parser generator? If so, which one? I probably
wouldn't attempt what you are doing without one.
The basic technique would be to generate an AST of the entire program
and then use a series of AST walking programs. The first pass would
look at declarations and initializations, while later passes would
handle executable statements, function calling, etc.
With tools supporting AST generation and AST walker generation,
things like function calling, control flow constructs and function
declaration are relatively simple. I've used PCCTs to generate
interpreters for C like languages, but I have no experience with
implementing OOP concepts.
Return to the
Search the comp.compilers archives again.