Commit Graph

10 Commits

Author SHA1 Message Date
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