Commit Graph

22 Commits

Author SHA1 Message Date
Rui Ueyama a8702a3011 Add keyword "int" and make variable definition mandatory 2020-09-13 21:36:37 +09:00
Rui Ueyama f26c8c26aa Make pointer arithmetic work 2020-09-13 21:36:37 +09:00
Rui Ueyama 73a66c9016 Add unary & and * 2020-09-13 21:36:37 +09:00
Rui Ueyama d87b191819 Add a representative node to each Node to improve error messages 2020-09-13 21:36:37 +09:00
Rui Ueyama 0567037e71 Add LICENSE and README.md 2020-09-13 21:36:37 +09:00
Rui Ueyama e822869ccc Add "while" statement 2020-09-13 21:36:37 +09:00
Rui Ueyama e410bfee49 Add "for" statement 2020-09-13 21:36:37 +09:00
Rui Ueyama e7e30e63c8 Add "if" statement 2020-09-13 21:36:37 +09:00
Rui Ueyama b90801dfcb Add null statement 2020-09-13 21:36:37 +09:00
Rui Ueyama aac6c1ed32 Add { ... } 2020-09-13 21:36:37 +09:00
Rui Ueyama 2dd952c5a8 Add "return" statement 2020-09-13 21:36:37 +09:00
Rui Ueyama 8798a8ecff Support multi-letter local variables 2020-09-13 21:36:37 +09:00
Rui Ueyama 7bcc4c66bd Support single-letter local variables 2020-09-13 21:36:37 +09:00
Rui Ueyama 5078ac1c0d Accept multiple statements separated by semicolons 2020-09-13 21:36:37 +09:00
Rui Ueyama b33b91b5e0 Split main.c into multiple small files 2020-09-13 21:36:37 +09:00
Rui Ueyama 2ceba8381f Add ==, !=, <= and >= operators 2020-09-13 21:36:37 +09:00
Rui Ueyama 980061e4e3 Add unary plus and minus 2020-09-13 21:36:37 +09:00
Rui Ueyama f6e012bf05 Add *, / and () 2020-09-13 21:36:37 +09:00
Rui Ueyama bd558a7df5 Improve error message
Now, chibicc can print out an error message with an error location
like this:

  $ ./chibicc 1+foo
  1+foo
    ^ expected a number
2020-09-13 21:36:37 +09:00
Rui Ueyama 3037c18930 Add a tokenizer to allow space characters between tokens 2020-09-13 21:36:37 +09:00
Rui Ueyama bf7081fba7 Add + and - operators 2020-09-13 21:36:37 +09:00
Rui Ueyama 0522e2d77e Compile an integer to an exectuable that exits with the given number 2020-09-13 21:36:28 +09:00