/var/spool/weblog
   


Prof Avery's weblog
one-way ticket to torpor

<spool@kenytt.net>

CSU Fullerton Perl Powered Python vi Hacker

Geek News

del.icio.us bookmarks

RSS


       
Sun, May 01, 2005

3AC Interpreter
I've posted a virtual machine written in Python that will execute the 3AC for Assignment 3. You can download a copy fo the 3AC factorial program here. Make sure that you have Python installed, then type

$ python 3vm.py factorial.3ac
You'll see a trace of memory accesses and the output of the program.

(Note: now that I've actually been able to run the program, I've updated the original factorial program and its corresponding 3AC code, and added a HLT instruction to the 3AC definition.)

/var/spool/courses/csuf/2005/spring/cpsc423 #

Example Parser and another Lexical Analyzer
If you had trouble finishing Assignment 2, you can download example.zip to start work on Assignment 3.

The parser was generated with the Coco/R compiler generator. To add semantic actions, you can either read the documentation, edit example.atg and re-generate the compiler, or you can modify the C code directly.

I chose Coco/R instead of YACC or Bison because it generates Recursive-Descent parsers instead of LALR(1) parsers. You are, of course, limited to LL(1) languges, but the resulting code is significantly easier to read and debug.

/var/spool/courses/csuf/2005/spring/cpsc423 #


       

 

January 2018
Sun Mon Tue Wed Thu Fri Sat
 
     

RSS

Topics


Archives