Related articles |
---|
info about OOP interpreter design and functions management? mrfaro@libero.it (Gabriele Farina) (2003-08-10) |
Re: info about OOP interpreter design and functions management? isaac@latveria.castledoom.org (Isaac) (2003-08-15) |
Re: info about OOP interpreter design and functions management? vbdis@aol.com (2003-08-20) |
Re: info about OOP interpreter design and functions management? kamalp@acm.org (2003-09-01) |
Re: info about OOP interpreter design and functions management? mrfaro@libero.it (Gabriele Farina) (2003-09-04) |
From: | Isaac <isaac@latveria.castledoom.org> |
Newsgroups: | comp.compilers |
Date: | 15 Aug 2003 23:46:22 -0400 |
Organization: | Road Runner - NC |
References: | 03-08-026 |
Keywords: | OOP, interpreter |
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
> initialization.
>
> 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.
Isaac
Return to the
comp.compilers page.
Search the
comp.compilers archives again.