Commit Graph

291 Commits

Author SHA1 Message Date
Rui Ueyama cf9ceecb2f Add flonum ==, !=, < and <= 2020-12-07 12:00:06 +09:00
Rui Ueyama 29de46aed4 Add "float" and "double" local variables and casts 2020-12-07 12:00:06 +09:00
Rui Ueyama 1e57f72d8a Add floating-point constant 2020-12-07 12:00:06 +09:00
Rui Ueyama 1fad2595d6 Allow to omit parameter name in function declaration 2020-12-07 12:00:06 +09:00
Rui Ueyama 93d12771d0 Ignore "static" and "const" in array-dimensions 2020-12-07 12:00:06 +09:00
Rui Ueyama b773554275 Ignore const, volatile, auto, register, restrict or _Noreturn. 2020-12-07 12:00:06 +09:00
Rui Ueyama 7ba6fe8d94 Handle unsigned types in the constant expression 2020-12-07 12:00:06 +09:00
Rui Ueyama 6880a39d2a When comparing two pointers, treat them as unsigned 2020-12-07 12:00:06 +09:00
Rui Ueyama 8b8f3de48b Use long or ulong instead of int for some expressions 2020-12-07 12:00:06 +09:00
Rui Ueyama aaf10459d9 Add U, L and LL suffixes 2020-12-07 12:00:06 +09:00
Rui Ueyama 34ab83bdf4 Add unsigned integral types 2020-12-07 12:00:06 +09:00
Rui Ueyama 3f59ce7955 Add `signed` keyword 2020-12-07 12:00:06 +09:00
Rui Ueyama 197689a22b Check the number of function arguments 2020-12-07 12:00:06 +09:00
Rui Ueyama 754a24fafc Add va_start to support variadic functions 2020-12-07 12:00:06 +09:00
Rui Ueyama 58fc86137c Allow to call a variadic function 2020-12-07 12:00:06 +09:00
Rui Ueyama dcd4579226 Handle a function returning bool, char or short
x86-64 psABI says that only the least significant 8 bits are
significant if RAX has a return value of a function returning bool.
Likewise, it looks like only the least significant 1 or 2 bytes
are guaranteed to have a correct value for char and short return
values, respectively.
2020-12-07 12:00:06 +09:00
Rui Ueyama 6a0ed71107 Align stack frame to 16 byte boundaries 2020-12-07 12:00:06 +09:00
Rui Ueyama ee252e6ce7 Add do ... while 2020-12-07 12:00:06 +09:00
Rui Ueyama eb85527656 Add static global variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 30b3e216cd Add return that doesn't take any value 2020-12-07 12:00:06 +09:00
Rui Ueyama 127056dc1d Add compound literals 2020-12-07 12:00:06 +09:00
Rui Ueyama 319772b42e Add static local variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 310a87e15e [GNU] Allow a variable as an operand of _Alignof 2020-12-07 12:00:06 +09:00
Rui Ueyama 9df51789e7 Add _Alignof and _Alignas 2020-12-07 12:00:06 +09:00
Rui Ueyama 27647455e4 Handle extern declarations in a block 2020-12-07 12:00:06 +09:00
Rui Ueyama 006a45ccd4 Add extern 2020-12-07 12:00:06 +09:00
Rui Ueyama 157356c769 Align global variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 7a1f816783 Accept `void` as a parameter list
`foo(void)` indicate that function foo does not take a parameter.
2020-12-07 12:00:06 +09:00
Rui Ueyama cd688a89b8 Allow to initialize struct flexible array member 2020-12-07 12:00:06 +09:00
Rui Ueyama 824543bb2f Add flexible array member 2020-12-07 12:00:06 +09:00
Rui Ueyama 3d216e3e06 Emit uninitialized global data to .bss instead of .data 2020-12-07 12:00:06 +09:00
Rui Ueyama fde464c47c Allow extraneous comma at the end of enum or initializer list 2020-12-07 12:00:06 +09:00
Rui Ueyama a58958ccb4 Allow extraneous braces for scalar initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama efa0f3366d Allow parentheses in initializers to be omitted 2020-12-07 12:00:06 +09:00
Rui Ueyama 1eae5ae367 Handle union initializers for global variable 2020-12-07 12:00:06 +09:00
Rui Ueyama eeb62b6dd5 Add struct initializer for global variable 2020-12-07 12:00:06 +09:00
Rui Ueyama bbfe3f4369 Add global initializer for scalar and string 2020-12-07 12:00:06 +09:00
Rui Ueyama 483b194a80 Handle union initializers for local variables 2020-12-07 12:00:06 +09:00
Rui Ueyama aca19dd350 Allow to initialize a struct with other struct 2020-12-07 12:00:06 +09:00
Rui Ueyama e9d2c46ab3 Handle struct initializers for local variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 5b95533603 Allow to omit array length if an initializer is given
So that you can write something like `int x[] = {1, 2, 3}`
instead of `int x[3] = {1, 2, 3}`.
2020-12-07 12:00:06 +09:00
Rui Ueyama 0d717373cc Add string literal initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama a754732c04 Skip excess initializer elements 2020-12-07 12:00:06 +09:00
Rui Ueyama ae0a37dc4b Initialize excess array elements with zero 2020-12-07 12:00:06 +09:00
Rui Ueyama 22dd560ecf Support local variable initializers 2020-12-07 12:00:06 +09:00
Rui Ueyama 79f5de21eb Add constant expression 2020-12-07 12:00:06 +09:00
Rui Ueyama 447ee098c5 Add ?: operator 2020-12-07 12:00:06 +09:00
Rui Ueyama d0c0cb74b2 Add <<, >>, <<= and >>= 2020-12-07 12:00:06 +09:00
Rui Ueyama 044d9ae07b Add switch-case 2020-12-07 12:00:06 +09:00
Rui Ueyama 3c83dfd8af Add continue statement 2020-12-07 12:00:06 +09:00