|[2 earlier articles]|
|Need Information on how to create bytecode firstname.lastname@example.org (Oliver Hunt) (2006-04-09)|
|Re: Need Information on how to create bytecode email@example.com (2006-04-09)|
|Re: Need Information on how to create bytecode Satyam@satyam.com.ar (Satyam) (2006-04-12)|
|Re: Need Information on how to create bytecode firstname.lastname@example.org (2006-04-12)|
|Re: Need Information on how to create bytecode email@example.com (DavidM) (2006-04-14)|
|Re: Need Information on how to create bytecode firstname.lastname@example.org (megavlad@gmail) (2006-04-17)|
|Re: Need Information on how to create bytecode email@example.com (kov) (2006-04-21)|
|Re: Need Information on how to create bytecode firstname.lastname@example.org (2006-04-25)|
|Date:||21 Apr 2006 23:43:11 -0400|
|Posted-Date:||21 Apr 2006 23:43:11 EDT|
I have a question, not necessarily for you, but for the knowledgeable
residents of comp.compilers: is p-code/bytecode the best solution? I
wrote a little scripting language once and felt sort of resigned to
generating bytecode just as you are doing, and while it ended up
working, debugging the scripts was a nightmare!
In contrast, a co-worker was recently showing me a scripting language
he'd developed which generated a parse-tree, with classes representing
the various node-types all descended from a single basic node. The
interpreter executed over the tree rather than P-code, and I found it
more straightforward to step through. I also found it fairly
flexible, allowing the development of continuations and other nifty
stuff, and it could be stored and read from an XML file.
I wonder why I don't see such a solution more often, except for the
fact that whenever we open up a book on compilers, they all assume
you're generating p-code/assembly.
[There isn't really that much practical difference between bytecodes
and a parse tree. A typical RPN byte code is easily generated by doing
a depth first walk of a parse tree, and you can rebuild the tree just
as easily as you read in the codes. -John]
Return to the
Search the comp.compilers archives again.