Absolute beginner - Need some pointers



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]
.



Relevant Pages

  • Rexx and Security
    ... I surmise from the text that the thought is that simply having an interpretive / scripting language installed in computers is dangerous as someone might develop an evil script / program with that tool. ... I would conclude that the only secure computing model in the opinions of the writers is that of the Linux / Unix environment which has the execute bit in the filesystem, and that the only programs allowed to be installed are statically compiled C/C++ programs. ... Requiring the interpreter to only interpret source files with the execute bit set is an option that comes to my mind... ...
    (comp.lang.rexx)
  • Re: Creating scripting language with JavaCC
    ... I want to create a simple scripting language - something like VBScript ... How do I create an AST for this, ... with their own tree. ... identifier() identifier ...
    (comp.compilers.tools.javacc)
  • Creating scripting language with JavaCC
    ... I want to create a simple scripting language - something like VBScript ... How do I create an AST for this, where there are multiple statements ... with their own tree. ...
    (comp.compilers.tools.javacc)
  • Re: Function pointers for DLL functions?
    ... extensible interpreted scripting language. ... of extending the language by adding functions written in C++. ... Why don't you embed a Python or Lua interpreter into your C++ app? ... combined ideas drastically reduces my development time, ...
    (microsoft.public.vc.mfc)
  • Re: Function pointers for DLL functions?
    ... extensible interpreted scripting language. ... of extending the language by adding functions written in C++. ... Why don't you embed a Python or Lua interpreter into your C++ app? ...
    (microsoft.public.vc.mfc)