haxala1r
c9694af826
vm and compiler: removed automatic currying, and several other modifications to the language
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
2026-05-10 17:23:42 +03:00
haxala1r
947d2274bb
vm: modified StoreLocal and StoreGlobal logic to be more consistent with the rest of the VM,
...
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
and modified the emit module to emit a Pop instruction after every top-level expression.
This change was required because the semantics of the language are pretty clear.
Every expression evaluates to something - meaning that, in the corresponding bytecode,
every expression must have exactly a +1 effect on the data stack. I.e. every expression,
when its corresponding bytecode is evaluated, has the effect of pushing something
to the stack. For values that are not used by another expression, this value
must be immediately popped.
Some optimizations could target this area. For example, for top-level expressions,
it is obvious to the compiler that their values will not be used - hence the compiler
can use optimized versions of some instructions (like StoreLocal and StoreGlobal)
to simply never leave the value on the stack, thus saving an extra Pop instruction
(good for performance and code size).
Same thing applies in function bodies, letrec/let/begin bodies, where expressions
whose values are never used may appear.
It may also make sense to introduce registers to the VM, for the purposes of
parameter passing (such that up to a predetermined number of parameters are
progressively passed through registers instead of pushed to the stack).
This would pair well with eliminating unnecessary currying in the byte code.
2026-04-26 01:20:05 +03:00
haxala1r
d846046c4a
Big changes:
...
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
Compiler and VM are now working well enough to support larger programs.
A test program is included and executed immediately upon running
the executable.
A more feature complete read-eval-print loop is planned.
2026-04-26 00:55:43 +03:00
haxala1r
0925b44ef7
vm: got the VM to finally actually work
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
2026-04-25 22:48:06 +03:00
haxala1r
4716c71b15
compiler: modify the Emit module to actually produce a vm_state object directly executable by the VM
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
2026-04-25 21:04:49 +03:00
haxala1r
2b02740e68
compiler: add the initial draft for compiling into byte code with backpatching
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
2026-04-25 20:46:28 +03:00
haxala1r
190ec94e14
compiler: make space for compiling into the VM bytecode
2026-04-25 20:44:37 +03:00
haxala1r
757df161d1
scope analysis: created another type to statically eliminate one (im)possible error case
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/cron/publish Pipeline failed
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
2026-04-05 23:14:29 +03:00
haxala1r
4792a296d3
interpreter: minor fixes, changes to the main binary to actually interpret some source code
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/cron/debian Pipeline was canceled
ci/woodpecker/cron/nix Pipeline was canceled
ci/woodpecker/cron/fedora Pipeline was canceled
ci/woodpecker/cron/publish Pipeline was canceled
2026-03-22 17:23:49 +03:00
haxala1r
cb7e3f8622
scope_analysis: changed convert to return the global symbol table as well as the program
2026-03-01 16:24:45 +03:00
haxala1r
fe26b6c2b3
scope_analysis & core_ast: added functions to convert directly from source for convenience
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
2026-02-28 18:59:37 +03:00
haxala1r
a95a676cb2
scope_analysis: small logic fix
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
2026-02-28 18:41:02 +03:00
haxala1r
24db34db62
scope_analysis: added support for deferred computation
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
2026-02-15 15:09:59 +03:00
haxala1r
8d301a6fc2
scope_analysis: fix the handling of Lambda forms
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
2026-02-12 18:32:36 +03:00
haxala1r
81dfc07867
compiler: added my first attempt at a scope analysis pass
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
2026-02-11 23:40:53 +03:00
haxala1r
bd6acf89e0
util: separated the monadic traverse into a utility module
2026-02-11 23:40:17 +03:00
haxala1r
a250d96c63
core_ast: remove letrec comment
2026-02-04 21:52:16 +03:00
haxala1r
3a3bf2c674
core_ast: removed letrec. we now treat it as let + set.
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
2026-02-02 22:36:55 +03:00
haxala1r
7402a688c7
compiler: remove unused files
2026-02-02 20:43:13 +03:00
haxala1r
ed4f49311c
syntactic_ast: unwrapped the central GADT into several related types.
...
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
core_ast: related to the above, reorganized core_ast to use the new syntactic ast
2026-02-02 20:32:15 +03:00
haxala1r
bd907fe69a
minor changes
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
2026-02-02 19:53:08 +03:00
haxala1r
d7729571ea
core_ast: modify the core ast to use unary functions
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
2026-01-16 22:34:35 +03:00
haxala1r
12b347de38
general: removed containers dependency
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/build-nix Pipeline was successful
2026-01-14 21:40:21 +03:00
haxala1r
11625c88c6
core_ast: add of_sexpr
ci/woodpecker/push/build Pipeline was successful
2026-01-14 12:28:22 +03:00
haxala1r
d41d8e5fbe
core_ast: add initial draft for the core ast, and a conversion function from the syntactic ast
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
2026-01-07 20:02:10 +03:00
haxala1r
ec56d76fb3
syntactic_ast: modify the phantom types to have concrete constructors, as the ocaml compiler cannot prove them distinct otherwise
ci/woodpecker/push/build Pipeline was successful
2026-01-07 20:00:11 +03:00
haxala1r
be81061895
syntactic_ast: fix issue in set! parsing, add set! to the test case.
ci/woodpecker/push/build Pipeline was successful
2026-01-07 18:18:38 +03:00
haxala1r
e25b6b0b10
syntactic_ast: fix issue in cond parsing
2026-01-07 18:17:24 +03:00
haxala1r
0d731f29b3
syntactic_ast: added a node for set! expressions
2026-01-07 18:13:55 +03:00
haxala1r
54c48ddf0e
syntactic_ast: add node for if expressions
ci/woodpecker/push/build Pipeline was successful
2026-01-07 18:03:28 +03:00
haxala1r
edc9d8b9e6
syntactic_ast: added parsing and pretty printing for cond expressions
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
2026-01-04 21:38:04 +03:00
haxala1r
e95a115acf
syntactic_ast: Added proper handling for Let and Letrec
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
2026-01-03 21:35:27 +03:00
haxala1r
9fb29afc3e
syntactic_ast: Modified letrec forms to also accept a body
ci/woodpecker/push/build Pipeline was successful
2026-01-03 20:49:17 +03:00
haxala1r
17e533dbb8
Modified the GADT to distinguish bodies
ci/woodpecker/push/build Pipeline was successful
2026-01-03 20:43:11 +03:00
haxala1r
6d95977324
ast: improved the implementation of syntactic_ast
...
ci/woodpecker/push/build Pipeline was successful
debug: added debug functions for the syntactic_ast module
Modified the compiler executable to test a little bit.
todo: Some nodes of the syntactic ast are not yet emitted,
2026-01-03 18:30:47 +03:00
haxala1r
cb94372f29
new ast: added a new syntactic_ast module that provides a more structured AST as a GADT
ci/woodpecker/push/build Pipeline was successful
2026-01-03 16:44:00 +03:00
haxala1r
bc7ca0fa2d
new library: added containers as a dependency.
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/manual/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
2026-01-01 13:36:09 +03:00
haxala1r
9981c222eb
Added desugar phase for converting cond into a chain of if's
2025-12-28 21:04:45 +03:00
haxala1r
624d420afe
Separated mutually recursive definition of desugar phases
...
They do not need to be mutually recursive at all. At first I thought
they would have to be, because I thought it would be best if each phase
completely desugared the bodies of the expressions they handle, but now
I see that would probably lead to an infinite loop.
There is simply no reason to couple them so tightly.
2025-12-28 21:04:45 +03:00
haxala1r
d80caadc85
Added gensym, and phases in the desugar module for logical and & or
2025-12-28 21:04:45 +03:00
haxala1r
be0d479665
Added desugar steps to add (begin) wrappers around long lambda bodies, and rewrite internal (define) forms into letrec forms
2025-12-28 21:04:45 +03:00
haxala1r
4f1ad54596
Started work on the compiler, with a desugar phase
2025-12-28 21:04:45 +03:00
haxala1r
adbf083c3d
Reorganized project
2025-12-28 21:04:45 +03:00