├── .gitignore ├── .merlin ├── LICENSE ├── Makefile ├── README.md ├── _oasis ├── configure ├── examples ├── binops │ ├── ex1.c │ ├── ex10.c │ ├── ex11.c │ ├── ex12.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ ├── ex6.c │ ├── ex7.c │ ├── ex8.c │ └── ex9.c ├── bitops │ ├── ex1.c │ ├── ex10.c │ ├── ex11.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ ├── ex6.c │ ├── ex7.c │ ├── ex8.c │ ├── ex9.c │ └── note.md ├── boolops │ ├── ex1.c │ ├── ex10.c │ ├── ex11.c │ ├── ex12.c │ ├── ex13.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ ├── ex6.c │ ├── ex7.c │ ├── ex8.c │ └── ex9.c ├── cmps │ ├── equals.c │ ├── greater_equal.c │ ├── greater_than.c │ ├── less_equal.c │ ├── less_than.c │ └── not_equals.c ├── consts │ ├── ex1.c │ ├── ex10.c │ ├── ex11.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ ├── ex6.c │ ├── ex7.c │ ├── ex8.c │ └── ex9.c ├── funs │ ├── ex1.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ └── ex6.c ├── if │ ├── ex1.c │ ├── ex10.c │ ├── ex11.c │ ├── ex12.c │ ├── ex13.c │ ├── ex14.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ ├── ex6.c │ ├── ex7.c │ ├── ex8.c │ ├── ex9.c │ └── if_nested.c ├── loops │ ├── for.c │ ├── for2.c │ ├── for_decl.c │ └── for_single_statement.c ├── unops │ ├── ex1.c │ ├── ex2.c │ ├── ex3.c │ ├── ex4.c │ ├── ex5.c │ └── ex6.c └── vars │ ├── ex1.c │ ├── ex2.c │ └── ex3.c ├── nqcc ├── setup.ml ├── src ├── ast.ml ├── context.ml ├── gen.ml ├── gen.mli ├── lex.ml ├── lex.mli ├── nqcc.ml ├── parse.ml ├── parse.mli ├── pprint.ml ├── pprint.mli ├── tok.ml ├── util.ml └── util.mli ├── test_examples.sh └── tst ├── test_lex.ml ├── test_lex.mli ├── test_nqcc.ml └── test_parse.ml /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/.gitignore -------------------------------------------------------------------------------- /.merlin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/.merlin -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/LICENSE -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/Makefile -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/README.md -------------------------------------------------------------------------------- /_oasis: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/_oasis -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/configure -------------------------------------------------------------------------------- /examples/binops/ex1.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2+2; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex10.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3- -4; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex11.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3-+4; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex12.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3 % 2; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3+'a'; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex3.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3*4; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex4.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3*4+2; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex5.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 5/4; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex6.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 4*-1; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex7.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return -4/-2; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex8.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 4/3*2; 3 | } -------------------------------------------------------------------------------- /examples/binops/ex9.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2-3; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex1.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1&2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex10.c: -------------------------------------------------------------------------------- 1 | int main(){ 2 | return 1&-0; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex11.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1^-0; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1|2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex3.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1^2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex4.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1>>2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex5.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 100<<2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex6.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1|-0; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex7.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return -1<<2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex8.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return -1>>2; 3 | } -------------------------------------------------------------------------------- /examples/bitops/ex9.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return -0<<3; 3 | } -------------------------------------------------------------------------------- /examples/bitops/note.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/bitops/note.md -------------------------------------------------------------------------------- /examples/boolops/ex1.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1&&0; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex10.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2 > 3; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex11.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 4 < 3; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex12.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 4 <= 3; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex13.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 4 >= 3; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1 || 0; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex3.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1 < 1; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex4.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1 <= 1; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex5.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1 > 1; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex6.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1>=1; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex7.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2==2; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex8.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2 != 2; 3 | } -------------------------------------------------------------------------------- /examples/boolops/ex9.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return (3+4 <= 4 || 1&&2 != 3 > 6); 3 | } -------------------------------------------------------------------------------- /examples/cmps/equals.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2==3; 3 | } -------------------------------------------------------------------------------- /examples/cmps/greater_equal.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2>=3; 3 | } -------------------------------------------------------------------------------- /examples/cmps/greater_than.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2>3; 3 | } -------------------------------------------------------------------------------- /examples/cmps/less_equal.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 3 <= 3; 3 | } -------------------------------------------------------------------------------- /examples/cmps/less_than.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2<3; 3 | } -------------------------------------------------------------------------------- /examples/cmps/not_equals.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2!=3; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex1.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 2; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex10.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return ((3)); 3 | } -------------------------------------------------------------------------------- /examples/consts/ex11.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/consts/ex11.c -------------------------------------------------------------------------------- /examples/consts/ex2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 'a'; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex3.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return '\b'; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex4.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return '\x03'; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex5.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return '\075'; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex6.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return '\''; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex7.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 012; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex8.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 0xf3; 3 | } -------------------------------------------------------------------------------- /examples/consts/ex9.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return '\\'; 3 | } -------------------------------------------------------------------------------- /examples/funs/ex1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex1.c -------------------------------------------------------------------------------- /examples/funs/ex2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex2.c -------------------------------------------------------------------------------- /examples/funs/ex3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex3.c -------------------------------------------------------------------------------- /examples/funs/ex4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex4.c -------------------------------------------------------------------------------- /examples/funs/ex5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex5.c -------------------------------------------------------------------------------- /examples/funs/ex6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/funs/ex6.c -------------------------------------------------------------------------------- /examples/if/ex1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex1.c -------------------------------------------------------------------------------- /examples/if/ex10.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex10.c -------------------------------------------------------------------------------- /examples/if/ex11.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex11.c -------------------------------------------------------------------------------- /examples/if/ex12.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex12.c -------------------------------------------------------------------------------- /examples/if/ex13.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex13.c -------------------------------------------------------------------------------- /examples/if/ex14.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex14.c -------------------------------------------------------------------------------- /examples/if/ex2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex2.c -------------------------------------------------------------------------------- /examples/if/ex3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex3.c -------------------------------------------------------------------------------- /examples/if/ex4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex4.c -------------------------------------------------------------------------------- /examples/if/ex5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex5.c -------------------------------------------------------------------------------- /examples/if/ex6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex6.c -------------------------------------------------------------------------------- /examples/if/ex7.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex7.c -------------------------------------------------------------------------------- /examples/if/ex8.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex8.c -------------------------------------------------------------------------------- /examples/if/ex9.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/ex9.c -------------------------------------------------------------------------------- /examples/if/if_nested.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/if/if_nested.c -------------------------------------------------------------------------------- /examples/loops/for.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/loops/for.c -------------------------------------------------------------------------------- /examples/loops/for2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/loops/for2.c -------------------------------------------------------------------------------- /examples/loops/for_decl.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/loops/for_decl.c -------------------------------------------------------------------------------- /examples/loops/for_single_statement.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/loops/for_single_statement.c -------------------------------------------------------------------------------- /examples/unops/ex1.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return -4; 3 | } -------------------------------------------------------------------------------- /examples/unops/ex2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return +4; 3 | } -------------------------------------------------------------------------------- /examples/unops/ex3.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return ~4; 3 | } -------------------------------------------------------------------------------- /examples/unops/ex4.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return !4; 3 | } -------------------------------------------------------------------------------- /examples/unops/ex5.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return !0; 3 | } -------------------------------------------------------------------------------- /examples/unops/ex6.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return ~-0; 3 | } -------------------------------------------------------------------------------- /examples/vars/ex1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/vars/ex1.c -------------------------------------------------------------------------------- /examples/vars/ex2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/vars/ex2.c -------------------------------------------------------------------------------- /examples/vars/ex3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/examples/vars/ex3.c -------------------------------------------------------------------------------- /nqcc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/nqcc -------------------------------------------------------------------------------- /setup.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/setup.ml -------------------------------------------------------------------------------- /src/ast.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/ast.ml -------------------------------------------------------------------------------- /src/context.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/context.ml -------------------------------------------------------------------------------- /src/gen.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/gen.ml -------------------------------------------------------------------------------- /src/gen.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/gen.mli -------------------------------------------------------------------------------- /src/lex.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/lex.ml -------------------------------------------------------------------------------- /src/lex.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/lex.mli -------------------------------------------------------------------------------- /src/nqcc.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/nqcc.ml -------------------------------------------------------------------------------- /src/parse.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/parse.ml -------------------------------------------------------------------------------- /src/parse.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/parse.mli -------------------------------------------------------------------------------- /src/pprint.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/pprint.ml -------------------------------------------------------------------------------- /src/pprint.mli: -------------------------------------------------------------------------------- 1 | val pprint: Ast.prog -> unit -------------------------------------------------------------------------------- /src/tok.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/tok.ml -------------------------------------------------------------------------------- /src/util.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/util.ml -------------------------------------------------------------------------------- /src/util.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/src/util.mli -------------------------------------------------------------------------------- /test_examples.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/test_examples.sh -------------------------------------------------------------------------------- /tst/test_lex.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/tst/test_lex.ml -------------------------------------------------------------------------------- /tst/test_lex.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/tst/test_lex.mli -------------------------------------------------------------------------------- /tst/test_nqcc.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/tst/test_nqcc.ml -------------------------------------------------------------------------------- /tst/test_parse.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlsandler/nqcc/HEAD/tst/test_parse.ml --------------------------------------------------------------------------------