aboutsummaryrefslogtreecommitdiff
path: root/src/types.h
Commit message (Collapse)AuthorAgeFilesLines
* Add `void` type and allow void* to be assigned to other ptr typesMustafa Quraish2022-02-051-1/+1
|
* Modify implementation of structs to support unionsMustafa Quraish2022-02-031-0/+1
| | | | | | 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.
* Add support for basic structsMustafa Quraish2022-02-031-0/+14
| | | | | | | | 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).
* Remove `putc` intrinsic and replace with `write(fd, buf, size)`Mustafa Quraish2022-02-031-0/+2
| | | | | `putc`, `puts`, and `putnum` in `std/common.cup` are now implemented in terms of the `write()` syscall.
* Allow implicitly converting between integer-like-typesMustafa Quraish2022-02-031-0/+2
| | | | This design should also be useful for structs down the road.
* Add support for `char` type + string/char literalsMustafa Quraish2022-02-021-1/+5
| | | | | | | | | | | 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.
* Add initial support for arrays (also no testing)Mustafa Quraish2022-02-021-1/+5
| | | | | | 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.
* Move type-related stuff to a separate fileMustafa Quraish2022-02-021-0/+26
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.