Commit Graph

80 Commits

Author SHA1 Message Date
Rui Ueyama 47f19371f7 Add pre ++ and -- 2020-12-07 12:00:06 +09:00
Rui Ueyama 01a94c04aa Add +=, -=, *= and /= 2020-12-07 12:00:06 +09:00
Rui Ueyama 736232f3d6 Support file-scope functions 2020-12-07 12:00:05 +09:00
Rui Ueyama 48ba2656fe Add enum 2020-12-07 12:00:05 +09:00
Rui Ueyama aa0accc75e Add character literal 2020-12-07 12:00:05 +09:00
Rui Ueyama 44bba965cb Add _Bool type
_Bool isn't just a 1-bit integer because when you convert a value
to bool, the result is 1 if the original value is non-zero. This
is contrary to the other small integral types, e.g. char, as you
can see below:

  char x  = 256; // x is 0
  _Bool y = 256; // y is 1
2020-12-07 12:00:05 +09:00
Rui Ueyama 9e211cbf1d Report an error on undefined/undeclared functions 2020-12-07 12:00:05 +09:00
Rui Ueyama a6b82da1ae Add typedef
In the following example, `x` is defined as an alias for `int`.

  typedef x;

Below is valid C code where the second `t` is a local variable
of type int having value 3.

  typedef int t;
  t t = 3;
2020-12-07 11:51:20 +09:00
Rui Ueyama 8c3503bb94 Add void type 2020-12-07 11:51:20 +09:00
Rui Ueyama 43c2f0829f Add long type 2020-10-15 14:22:16 +09:00
Rui Ueyama 11e3841832 Add union 2020-10-15 14:22:16 +09:00
Rui Ueyama f0a018a7d6 Add -> operator 2020-10-15 14:22:16 +09:00
Rui Ueyama f814033d04 Add struct 2020-10-15 14:22:16 +09:00
Rui Ueyama 6647ad9b84 Precompute line number for each token
No functionality change
2020-10-15 14:22:16 +09:00
Rui Ueyama 6c0a42926a Add line and block comments 2020-10-08 16:23:53 +09:00
Rui Ueyama d9ea59757e Read code from a file instead of argv[1] 2020-10-08 16:23:49 +09:00
Rui Ueyama c2cc1d3c45 Add \x<hexadecimal-sequence> 2020-10-08 15:43:05 +09:00
Rui Ueyama 699d2b7e3f Add \<octal-sequence> 2020-10-08 15:43:04 +09:00
Rui Ueyama ad7749f2fa Add \a, \b, \t, \n \v, \f, \r and \e 2020-10-08 15:42:45 +09:00
Rui Ueyama 4cedda2dbe Add string literal 2020-10-07 20:13:26 +09:00
Rui Ueyama be38d63d1b Add char type 2020-10-07 20:13:26 +09:00
Rui Ueyama 3e55cafef8 Add sizeof 2020-10-07 20:13:26 +09:00
Rui Ueyama b4e82cf7ce Add keyword "int" and make variable definition mandatory 2020-10-07 20:13:25 +09:00
Rui Ueyama 1f3eb34f63 Add "while" statement 2020-10-07 20:13:25 +09:00
Rui Ueyama f5d480f139 Add "for" statement 2020-10-07 20:13:25 +09:00
Rui Ueyama 72b841508f Add "if" statement 2020-10-07 20:13:19 +09:00
Rui Ueyama 6cc1c1f064 Add "return" statement 2020-10-07 20:12:57 +09:00
Rui Ueyama 482c26b536 Support multi-letter local variables 2020-10-07 20:12:19 +09:00
Rui Ueyama 1f9f3adf32 Support single-letter local variables 2020-10-07 20:11:48 +09:00
Rui Ueyama 725badfb49 Split main.c into multiple small files 2020-10-07 20:11:16 +09:00