Re: Need Information on how to create bytecode

"kov" <ken.overton@gmail.com>
21 Apr 2006 23:43:11 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Need Information on how to create bytecode ojh16@student.canterbury.ac.nz (Oliver Hunt) (2006-04-09)
Re: Need Information on how to create bytecode haberg@math.su.se (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 scavadini@ucse.edu.ar (2006-04-12)
Re: Need Information on how to create bytecode amedlock@gmail.com (DavidM) (2006-04-14)
Re: Need Information on how to create bytecode megavlad@gmail.com (megavlad@gmail) (2006-04-17)
Re: Need Information on how to create bytecode ken.overton@gmail.com (kov) (2006-04-21)
Re: Need Information on how to create bytecode anton@mips.complang.tuwien.ac.at (2006-04-25)
| List of all articles for this month |

From: "kov" <ken.overton@gmail.com>
Newsgroups: comp.compilers
Date: 21 Apr 2006 23:43:11 -0400
Organization: http://groups.google.com
References: 06-04-048
Keywords: interpreter, comment
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]


Post a followup to this message

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