aboutsummaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Fix examples to include return type on main functionMustafa Quraish2022-02-026-6/+6
| | | | With the fancy new type checking these are now required.
* Add basic `defer` implementation.Mustafa Quraish2022-02-011-0/+13
| | | | | | 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 basic builtin-function supportMustafa Quraish2022-01-313-3/+34
| | | | | | | This isn't really super extendible for now, but it's a start and gives us the `print` builtin which allows us to finally actually print out values to the screen, so we can move away from testing with exit codes eventually.
* Remove return-0 exampleMustafa Quraish2022-01-301-3/+0
| | | | | The language has progressed enough now to the point where that doesn't do anything meaningful anymore.
* Functions, yay!Mustafa Quraish2022-01-301-0/+13
| | | | | | | | | | | | | | | 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.
* Add for and while loop support (w/o declarations in `for`)Mustafa Quraish2022-01-291-0/+22
| | | | | | 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.
* Allow uninitialized variable declarationsMustafa Quraish2022-01-291-5/+4
|
* Now supporting local variables! :^)Mustafa Quraish2022-01-291-0/+8
|
* Add relational and logical operators + refactor binop parserMustafa Quraish2022-01-291-0/+3
| | | | | | | | | 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.
* Add some arithmetic binary operations into lex+parse+generationMustafa Quraish2022-01-281-0/+3
|
* Examples: Add example for unary ops, remove type hintsMustafa Quraish2022-01-282-2/+8
| | | | We ignore the types for now anyway, so let's just leave them out
* Initial commit + start of lexerMustafa Quraish2022-01-241-0/+3