aboutsummaryrefslogtreecommitdiff
path: root/src/tokens.h
Commit message (Collapse)AuthorAgeFilesLines
* Add support for some more binary ops: |, &, ^Mustafa Quraish2022-02-051-0/+1
|
* Add `sizeof(<type>)` operator that can return the size of a type.Mustafa Quraish2022-02-051-0/+1
|
* Add `void` type and allow void* to be assigned to other ptr typesMustafa Quraish2022-02-051-0/+1
|
* Add an enum-like-but-not-really structureMustafa Quraish2022-02-041-0/+1
| | | | | | Basically, it looks like an enum but it isn't actually a type. It just behaves like a container to number all the (global) constants defined within it.
* Add support for read-only constant expressionsMustafa Quraish2022-02-041-0/+1
| | | | | | | We can now have constant definitions that are read-only, evaluated at compile time and just behave like integer literals when accessed. These are nice because we can now potentially inject syscall numbers/ etc through the compiler.
* 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/+2
| | | | | | | | 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).
* Add support for `char` type + string/char literalsMustafa Quraish2022-02-021-0/+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-0/+2
| | | | | | 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.
* Add basic `defer` implementation.Mustafa Quraish2022-02-011-0/+1
| | | | | | We don't have any closures yet, so it's essentially the same as just moving the statement after the `defer` keyword to the end of the block/ right before returning from the function.
* Add ability to import other filesMustafa Quraish2022-01-311-0/+1
| | | | | | This still requires a lot of work to avoid duplicate imports, and handle cyclic imports, but it is a good enough for small examples which just want to include some common definitions from std/
* Put tokens in their own macro to allow looping over themMustafa Quraish2022-01-301-11/+15
|
* Rename `cup` directory to `src`Mustafa Quraish2022-01-301-0/+83