Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 684 Bytes

readme.md

File metadata and controls

31 lines (20 loc) · 684 Bytes

A very simple compiler that compiles C- language defined in Compiler Design and Construction to javascript.

#Setup

This project depends on Jison (the javascript version of GNU Bison) which you can install via npm;

npm install -g jison

js-beautify is used to prettfy the code generated by Jison.

npm i

#Usage

Use Jison to generate the language parser defined in cc2js.jsion

jison cc2js.jsion

Use the parser to translate c file to js, for instance:

node cc2js.js tests/a.c

The translation result will be stored in a file named out.js.