[antlr-interest] the tree parser example

J. Stephen Riley Silber jsrs701 at yahoo.com
Wed May 1 11:47:08 PDT 2002

Hi gang,

This message is intended mostly for Lloyd Dupont, but feel free to peruse
it if you are not him.  :)

Attached is a zip file containing the entire ProtoC project.  ProtoC is a
prototype-based, OO language that fits somewhere in the C family of

(What does "prototype-based" mean?  Glad you asked.  In short, there is no
such thing as a "class", though everything is an object.  Hm.  How about
some examples?  Omega, NewtonScript, the long-running Dr. Dobbs language
Bob, and the grandaddy of them all, Self.)

For a brief and very outdated overview of the language, see

A few notes about the code (caveat emptor!):
* It's a Microsoft Visual Studio .NET project.

* It's my first ANTLR project of any real size.

* You'll find the ANTLR grammar in pc.g, under the pcc subproject.

* The ProtoC compiler (pcc) takes a string or file, runs it through the
ANTLR code, which results in a bytecode assembly language text string.  
This is then fed to the assembler (pcasm).  The resulting bytecode is
executed by the virtual machine (pcvm), using a very dynamic runtime
library of objects (pcobjs).

* Oh yeah, I should mention that while the project compiles and runs,
there are some logic errors in the output.  This is NOT a finished
project!  :)

A few notes about the ANTLR part:
* The lexer, parser, and tree walker are all in one file.

* I don't have any tree transform optimizers yet.  When I get around to
that, I'll probably make a tree walker superclass, and then have all the
walkers (including the final assembly code emission walker) descend from

* But for now, the parser just emits a tree, and the tree walker just
makes a single pass and dumps code.

I'll be hapy to entertain questions.

Enjoy, hope this helps,

J. Stephen Riley Silber
 "Pig, your freedom lies before you!  Flee into the
  forest and join your piggy friends!"


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProtoC.zip
Type: application/zip
Size: 233956 bytes
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20020501/43e9cbb0/ProtoC.zip

More information about the antlr-interest mailing list