Absolute beginner - Need some pointers

NickCarlson <nacarlson@gmail.com>
Wed, 27 Feb 2008 15:02:21 -0800 (PST)

          From comp.compilers

Related articles
Absolute beginner - Need some pointers nacarlson@gmail.com (NickCarlson) (2008-02-27)
Re: Absolute beginner - Need some pointers DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-02-28)
Re: Absolute beginner - Need some pointers bc@freeuk.com (Bartc) (2008-02-29)
Re: Absolute beginner - Need some pointers anton@mips.complang.tuwien.ac.at (2008-03-02)
Re: Absolute beginner - Need some pointers anton@mips.complang.tuwien.ac.at (2008-03-03)
Re: Absolute beginner - Need some pointers anton@mips.complang.tuwien.ac.at (2008-03-04)
Re: Absolute beginner - Need some pointers gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-03-05)
[1 later articles]
| List of all articles for this month |

From: NickCarlson <nacarlson@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 27 Feb 2008 15:02:21 -0800 (PST)
Organization: Compilers Central
Keywords: interpreter, question, comment
Posted-Date: 27 Feb 2008 21:59:42 EST

Hi.


My long term goal is to write a scripting language similar to lua to
replace php (for my own work). At the moment though, I'd be happy just
implemented an interpreter what acted as a calculator.


I've written a (half finished) MIPS emulator in the past, so I'm
hoping that experience will help me with this.


At the moment, my understanding of how to go about implementing this
is as follows:


(we'll call my new language Omega for now)
i. Write a lexical analyzer to convert to Omega code into a tree
structure that the parser can parse.
2. Write a parser to parse the tree structure into bytecode.
C. Write a virtual machine that can execute the bytecode.


The problem is implementing the virtual machine. From my
understanding, it's a lot like writing an emulator, except you get to
choose what the opcodes are. Am I right here? From what I've read, I'd
prefer to write a register-based interpreter as opposed to a stack
based one, because the register based approach seems more intuitive to
me.


Can anyone give me a few tips on how to go about doing this? I'd like
to start out as simple as possible. I've looked through Lua's and
Parrot's source code, but it's more confusing that helpful at this
point.


Thanks.
[Unless you plan to save the bytecode to a file and reload it later,
it's easier just to interpret the trees. -John]


Post a followup to this message

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