travis-heavener / tpu2

The Terrible Processing Unit, a 16-bit CPU using a non-segmented 64KiB of memory and is loosely based off of the 8086 processor.
0 stars 0 forks source link

Add Support for Function Calls to T Language #5

Open travis-heavener opened 1 week ago

travis-heavener commented 1 week ago

Improve the lexer and parser to support calling functions with arguments. The actual arguments passed to a function must also be dealt with in the t_assembler.cpp, since they're scoped variables. In the expression assembler when a function is met, just evaluate the expression inside for each argument, push them to the stack, and call the corresponding label after looking it up. After the end of the label is met, grab the return value out of DX and push that onto the stack in the expression assembler.

travis-heavener commented 6 days ago

WIP as of 0bdd981

travis-heavener commented 5 days ago

Added as of commit 4d59318, still need to force return on non-void functions, prevent invalid parameters being provided, and handle void as a return type.

travis-heavener commented 4 days ago

Improved in commit 0145bc8, working on forcing parameters, supporting void types, and confirming return sizing now.

travis-heavener commented 4 days ago

Also needed: prevent duplicate functions but allow distinction from arguments.