Commit Graph

16 Commits

Author SHA1 Message Date
Aryadev Chavali
2fe2af22a9 Implemented a rudimentary parser with support for 4 instruction types 2023-10-26 11:17:55 +01:00
Aryadev Chavali
d1f84a6a2c Makefile now prints dependencies on successful compilation 2023-10-26 10:22:10 +01:00
Aryadev Chavali
74a85268c4 Moved base functions from inst.c to dedicated file
Doesn't make sense for them to be in the VM module when they have a
more general purpose now.
2023-10-26 10:19:10 +01:00
Aryadev Chavali
94abb9e3d4 Separated lexer from main file in asm 2023-10-25 21:43:13 +01:00
Aryadev Chavali
92855ebb3e Starting development on assembly language 2023-10-23 16:53:50 +01:00
Aryadev Chavali
42ac28d44a Make root directory an include path, set #include's properly
Easier to write includes now just using < with the module name, in
comparison to using relative paths.
2023-10-23 04:46:09 +01:00
Aryadev Chavali
0ac634a9be Reintroduced example fib.c via examples/ folder 2023-10-23 04:25:48 +01:00
Aryadev Chavali
ac57e32a02 Added lib folder for general stuff, introduced as target to Makefile 2023-10-23 04:25:48 +01:00
Aryadev Chavali
b44a61be41 src->vm, Makefile is now a bit more abstracted and pretty colours
Changed folder names for sake of clarity (will be introducing a new
build target soon), and Makefile can now easily support more targets.
2023-10-23 03:58:34 +01:00
Aryadev Chavali
919fae2df8 Added an example program fib.c
This is simply a program with an embedded set of instructions which
indefinitely computes and prints fibonacci numbers, computing them in
pairs.

Does it completely through the virtual machine rather than just hard C
instructions.

Also amended the Makefile to compile it.  Required moving the main.c
object file into the dependencies of $(DIST)/$(OUT).

I should track the dependencies for fib.c and main.c as well.
2023-10-23 00:45:23 +01:00
Aryadev Chavali
ed63025927 Added flag to Makefile to set VERBOSE macro in base.h 2023-10-22 18:26:33 +01:00
Aryadev Chavali
cf23a62008 Made a debug and release configuration via flags
Also split out the check for whether $(DIST) exists by making it its
own recipe.  Removes the repeated checks in each object compilation.
2023-10-22 18:07:41 +01:00
Aryadev Chavali
6038363d2f Added functionality to read and write instruction bytecode
Uses some bit hacks to quickly check what data type an opcode may have
by shifting down to units then casting it to a data_type_t.
Not very well tested yet, we'll need to see now.
2023-10-16 01:18:05 +01:00
Aryadev Chavali
c24c1d1607 Implemented a dynamically sized byte array
Pretty simple, want to ensure amortised constant big O so I use a
REALLOC_MULT, which can be redefined if wished.
2023-10-15 21:50:31 +01:00
Aryadev Chavali
639808a092 Moved vm_* code to its own file (runtime.(h|c)) 2023-10-15 21:41:16 +01:00
Aryadev Chavali
16e2275576 First commit!
This is a from the ground rework of an old project of the same name.
I'm hoping to be more concerned with runtime efficiency, bytecode size
and all those things that should actually matter for something that
may host time/space critical code.
2023-10-15 01:25:24 +01:00