[Mono-list] writing an interpreter in c#

Derek Gottfrid derek@codecubed.com
Sun, 18 May 2003 22:50:58 -0400 (EDT)


i developed a small language  in c# as well. i started with coco but ran
into
problems. running the coco executable against your grammer spec under mono
appears to work but after much frustration i realized that the combination
of mono + coco produced incorrect code. worked fine under windows and the
msft clr. i didn't venture much further after that experience with coco
and switch instead to antrl - antrl supprot for c# and mono seems way
beeter plus overall antrl appears to be a more complete product. anyway i
would be interest to here what progress you make. good luck.

enjoy
derek


On Sun, 18 May 2003, Kunle Odutola wrote:

> Stuart,
>
> You could try ANTLR. It's an LL(k) parser generator [Coco/R is essentially
> LL(1) if memory serves] that generates human-readable recursive descent
> lexers/parsers/treeparsers in C#, Java and C++.
>
> One way of writing an interpreter with ANTLR is to develop a Lexer grammar
> and a Parser grammar as usual as well as a TreeParser grammar. The
> TreeParser walks the syntax trees (usually ASTs) built for your source files
> by your ANTLR grammar and executes action code that performs the actual
> "interpretation". An AST "executor" if you will.
>
> http://tros.org/portfolio/#Interpreter - Interpreter built with ANTLR/C++
> http://nexus.cs.usfca.edu/~parrt/course/652/
> (See http://nexus.cs.usfca.edu/~parrt/course/652/labs/interp.html for a
> sample interpreter built with ANTLR/Java )
>
> Alternatively you can simply add action code to your Parser grammar to build
> your ASTs in your current manner. You can then continue to use whatever
> techniques you are familiar with once the AST has been built.
>
> You can find ANTLR at www.antlr.org
>
> Good luck,
>
> Kunle
> ANTLR/C# codegen
>
>
> > -----Original Message-----
> > From: mono-list-admin@lists.ximian.com
> > [mailto:mono-list-admin@lists.ximian.com]On Behalf Of
> > stett@cs.iastate.edu
> > Sent: 18 May 2003 01:19
> > To: mono-list@ximian.com
> > Subject: [Mono-list] writing an interpreter in c#
> >
> >
> > Hi,
> >         I'm wanting to write an interpreter in C# on my linux machine.
> > I have been looking at the mono source for help on this project. I have
> > come across a project called Coco/R for C# to generate a scanner and
> > parser, but I have been unable to figure out how to get that working on
> > a linux machine. I thought maybe I needed to get CLI for linux. I'm trying
> > to install it, but it gives me an error:
> >
> > $ ./buildall
> > ...
> > PAL build complete.
> > gcc -o
> > /home/stuart/tmp/sscli_linux_20020821/build/v1.x86fstchk.rotor/nmake
> > /usr/lib/crti.o /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/crtbegin.o
> > ../../pal/unix/startup/objdf/palcrt1.o   getrcmsg.o  action.o  build.o
> > charmap.o  command.o  error.o  exec.o  file.o  globals.o
> > ifexpr.o  init.o
> > inline.o  lexer.o  macro.o  nmake.o  parser.o  print.o  rpn.o
> > rule.o  util.o
> > utilp.o  win32.o /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/crtend.o
> > /usr/lib/crtn.o  -nostartfiles -pthread
> > -L/home/stuart/tmp/sscli_linux_20020821/build/v1.x86fstchk.rotor
> > -lrotor_pal
> > -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2 -lgcc
> > action.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > build.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > command.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > error.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > exec.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > ifexpr.o(.eh_frame+0x11): more undefined references to
> > `__gxx_personality_v0' follow
> > collect2: ld returned 1 exit status
> > make: ***
> > [/home/stuart/tmp/sscli_linux_20020821/build/v1.x86fstchk.rotor/nmake]
> > Error 1
> >
> > Please let me know if you know how to debug this error or if you have any
> > suggestions/references/etc for
> > my project (writing an interpreter for a Maya Embedded Language
> > in C# on a linux
> > computer). Any help
> > would be very much appreciated.
> >
> > Thanks in advance,
> > Stuart
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>