| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
|
|
| |
(1) Return correct size for unions
(2) Make sure function name identifier doesn't exist
(3) Assign `<anonymous>` as display name for nested compound types
|
| | |
|
| |
|
|
|
|
| |
This was simple enough, we just needed to change the part where we
were computing the offset for each field, and the total size of the
compound structure.
|
| |
|
|
|
|
|
|
| |
Structs for now (and probably for the near future) are not allowed
to be passed by value, and instead you just pass a pointer to it.
Nested structs can also be defined, and they can be either anonymous,
or named (in which case only the members can access the type).
|
| |
|
|
|
|
| |
The implementation is very hacky, maybe there's a better way to go
about doing this. Maybe just keep it as single AST node and do the
work during codegen?
|
| |
|
|
|
|
|
|
|
|
| |
This was possible, but very tedious to do by hand before. Now we
automate it based on the number of arguments.
Note that currently we can't just add `syscall3()` etc as builtins
because the actual numbers for the system calls vary from one system
to another, and we want to maintain support for macOS and Linux (at
least for now).
|
| |
|
|
| |
Since we allow implicit conversions now the exact type is less relevant.
|
| |
|
|
|
| |
`putc`, `puts`, and `putnum` in `std/common.cup` are now implemented
in terms of the `write()` syscall.
|
| |
|
|
| |
This design should also be useful for structs down the road.
|
| |
|
|
| |
Simple optimization, it was just adding extra overhead anyway.
|
| |
|
|
|
|
|
|
|
|
|
| |
This commit does a few things in one go:
- Add support for a `char` type + some changes to support the new size
- Add support for character literals. We need some escaping here to be
able to use `\n` and `\0`, etc.
- Add support for string literals. These are all stored in the `.data`
section. Fortunately NASM already handles the escape characters.
- Fix some bugs with code generation, specifically using `movsx` to sign
extend the smaller types into 64-bit registers.
|
| |
|
|
|
|
| |
Usual disclaimer at this point: Quick&Dirty implementation, hasn't
been tested other than basic sanity checks. Arrays are automatically
decayed into pointers when the identifier is accessed.
|
|
|
It was getting a bit unwieldy in `parser.c`, and this will potentially
help when we start dealing with more complex type-stuff such as
casting / conversions / etc.
|