aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Remove old test which disallowed initializing globalsMustafa Quraish2022-02-051-8/+0
|
* Add some simple tests for arrays+stringsMustafa Quraish2022-02-031-0/+131
|
* Remove `putc` intrinsic and replace with `write(fd, buf, size)`Mustafa Quraish2022-02-031-35/+0
| | | | | `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-1/+1
| | | | This design should also be useful for structs down the road.
* Type checking of expressions / functions!Mustafa Quraish2022-02-025-117/+117
| | | | | | | | | | | | | | | | | This is a bit of a chonky commit, but it adds in the basics of checking the types of expressions / function calls / return types. There's still a lot of work to be done, including: (1) Adding new core types, and casting between allowed types automatically (2) Picking the corrent output type based on input types (for instance float+int == float) (3) We need much better error reporting, the error messages are really vague and unhelpful as-is (4) We also need to work to ensure that a function with a return type actually returns (5) Possible re-factoring to make stuff less hacky when we have more types / structs / arrays / etc.
* Add basic `defer` implementation.Mustafa Quraish2022-02-012-1/+64
| | | | | | 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.
* Testing: Add support for testing stdout results, check builtinsMustafa Quraish2022-02-012-0/+103
|
* Global variables now supported! + some fixes to OP_ASSIGNMustafa Quraish2022-01-311-21/+64
| | | | | | Previously we weren't creating a new assignment node, and this was causing all sorts of funky errors. This commit also fixes that, and we can now use global variables :^)
* Move around tests in the categories; Add missing testsMustafa Quraish2022-01-314-179/+197
| | | | | We now also test for local variables in functions, and add a simple test to see if imports work properly.
* Update build system to use MakefileMustafa Quraish2022-01-301-21/+4
| | | | | | | | | `make` to compile the compiler `make XXX.out` to assemble/link `XXX.nasm` into an executable `make test` to run all tests `make tests/XXX` to run `tests/XXX.sh` test file `./run.sh <cupcc args>` to build, compile, run and show exit code
* Functions, yay!Mustafa Quraish2022-01-301-0/+63
| | | | | | | | | | | | | | | We now support function calls! We don't have support for forward declaring functions right now though, so no mutual recursion is possible. The arguments are passed via the stack instead of through registers (unlike the x86_64 calling convention, I think). We'll probably need some sort of primitives built into the language for syscalls eventually because of this. Return types are also not checked, and right now it's possible to have a function that doesn't return anything even when the caller expects it to, error checking and reporting definitely needs to be improved.
* Make the compiler / scripts work on Linux too (yay!)Mustafa Quraish2022-01-291-3/+14
|
* Add for and while loop support (w/o declarations in `for`)Mustafa Quraish2022-01-291-0/+118
| | | | | | We can now loop and do stuff, yay! However, we don't yet allow declarations inside the for-loop initializer, since that is a bit more annoying to implement.
* Implement blocks (lexically scoped) and conditionalsMustafa Quraish2022-01-294-2/+287
|
* Allow uninitialized variable declarationsMustafa Quraish2022-01-292-20/+33
|
* Add some tests for local variablesMustafa Quraish2022-01-293-0/+54
|
* Add relational and logical operators + refactor binop parserMustafa Quraish2022-01-291-1/+34
| | | | | | | | | We now support OR and AND with short circuiting! (Yet to be tested since we don't yet have local variables to play with). The binop parser took a bit of an overhaul factoring out the common code so that it's easier to describe the operator precendence relationships without being overly repetitive.
* Scripts: Reorganize a bit, add some rudimentary shell-testingMustafa Quraish2022-01-282-0/+66
Just to make sure we don't break stuff. We'll probably want better unit tests specifically for each part once we're more stable.