|Absolute beginner - Need some pointers email@example.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 firstname.lastname@example.org (Bartc) (2008-02-29)|
|Re: Absolute beginner - Need some pointers email@example.com (2008-03-02)|
|Re: Absolute beginner - Need some pointers firstname.lastname@example.org (2008-03-03)|
|Re: Absolute beginner - Need some pointers email@example.com (2008-03-04)|
|Re: Absolute beginner - Need some pointers firstname.lastname@example.org (glen herrmannsfeldt) (2008-03-05)|
|[1 later articles]|
|Date:||Wed, 27 Feb 2008 15:02:21 -0800 (PST)|
|Keywords:||interpreter, question, comment|
|Posted-Date:||27 Feb 2008 21:59:42 EST|
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
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
[Unless you plan to save the bytecode to a file and reload it later,
it's easier just to interpret the trees. -John]
Return to the
Search the comp.compilers archives again.