C interpreter which runs on the JVM.
Supports:
- Multi-dimensional arrays
- Variable arguments
- Pointer aritmetic
- Recursion
- Multilevel pointers
- Function pointers
- Unsigned types
- Memory allocation
- Structures, enumerations
libraryDependencies += "com.github.bdwashbu" % "cengine_2.11" % "0.0.5"
From the sbt console:
scala> import c.engine.Interpreter._
scala> c"""printf("Hello world!");"""
Hello world!
For all code, standard output of cEngine must exactly match that of gcc. Tested against gcc 5.3.0.
scalatest and sbt-coverage are very helpful.
cEngine was bootstrapped off of java.util.Formatter but it can now execute an embedded version of printf, ee_printf.
ee_printf is found here: https://github.com/bwalex/supermips/blob/master/software/coremark/supermips/ee_printf.c
Using d3.js to visualize the AST is very helpful.
All code executed by cEngine can be succesfully compiled with gcc.