vertexshader256 / cengine   0.0.5

Apache License 2.0 GitHub

Execute C code on the JVM

Scala versions: 2.11


C interpreter which runs on the JVM.


  • 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"

Hello world

From the sbt console:

scala> import c.engine.Interpreter._
scala> c"""printf("Hello world!");"""
Hello world!


Test approach:

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:


Using d3.js to visualize the AST is very helpful.

cEngine Debugger


All code executed by cEngine can be succesfully compiled with gcc.