C interpreter

Applications, examples, and sample programs using products from Comfile Technology

C interpreter

Postby rhoward99 » Thu Dec 08, 2011 4:58 pm

To becom familiar with the MOACON, I have ported a little C interpreter to run on the controller. It is not exremely robust (no pre/post increment/decrement, pointers, and only int and char variables), but it does support looping and functions. Scripting is now possible on the MOACON!

The code for this C interpreter is ported from the interpreter described in the Dr. Dobbs Journal Article "Building Your Own C Interpreter"
on the web at http://drdobbs.com/cpp/184408184.

I added some additional "library" functions in the file lclib.c for things such as relay output, digital input, lcd ouput, etc. Additional modifications are encouraged! If you modify the source, whether to add a feature or fix a bug, please share the code!

Note that the code makes use of the syscalls.c file located in the directory <MOACON STUDIO INSTALL DIRECTYR>\$CFC files\ARM\io_putchar.
You will need to modify the parser.csp file to point to the file on your system.

Enjoy!
Rick Howard
Exquadrum, Inc.
Attachments
CParser.zip
C Parser Source
(12.6 KiB) Downloaded 652 times
rhoward99
Terminator
 
Posts: 9
Joined: Wed Jan 21, 2009 9:27 am

Return to Applications and Examples

Who is online

Users browsing this forum: No registered users and 1 guest

cron