You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mryouse 2dd85b8109 6/8/2023 update 6 hours ago
Makefile add Makefile 2 weeks ago 6/8/2023 update 6 hours ago
chunk.d bugfix: first and last should return Seqs 2 days ago
compiler.d bugfix (wrong): builtins need to be available to HOFs 6 hours ago
core.neb more core functions 6 hours ago
dbg.d add more disassemble ops 2 days ago
fib.neb dumb benchmark 3 weeks ago
functions.txt 6/7/2023 update 1 day ago
main.d initial commit of the start of the core library 1 day ago
parser.d initial commit of branch 1 day ago
vm.d bugfix (probably wrong): this *seems* to stop the offset issues on stack B, but I'm not sure why 6 hours ago


now in bytecode

broken things

  • VM immediately returns after a def (fixed with d13ae11c4f?)
  • lists work for atoms like (list 1 2 3) but not evaluated expressions like (list (+ 2 3) 4 5) fixed with d95e4f6f98 and 9fe6496202. i'm almost definitely still bastardizing bytecode.
  • the emitted code is lousy with runtime typechecks. these are good to have, generally speaking, but a) should be able to do more compile time type checks to avoid some of them, b) should only need to type check certain things once (so long as variables can't change type), and c) should probably generalize the typecheck op with a parameter to enable more flexibility
  • [-] compiler errors don't stop the VM from running, and are not particularly helpful stopped running with 11e9f1d854, helful? not really, not yet.
  • defining multiple functions in a script doesn't seem to work? fixed with fb4a026dc1
  • there are many instances of popping on an empty stack. i have a warning emitted, which should help me track it down at some point, but at least it doesn't crash. Update 6/5: this is starting to really concern me
  • append on an empty list segfaults fixed with af07e3fba5
  • arity checking is entirely arbitrary for builtins, non-existant for user-defined functions
  • [-] parsing does not handle types correctly, or comments at all parse (but ignore) types with 919994fd32, parse comments with 9867aade2a
  • bounds issues (first/last on empty sequences) crashes entirely
  • constants get duplicated in chunks
  • a space at the end of (definitions? lists?) crashes
  • [-] HOF can't take in builtins (they're not actually in the global environment) hacky non-final solution with 4446f10ea7
  • looking up local variables in surrounding scopes does not work
  • i mean, nearly nothing works

things that hopefully work

  • math (*+/-)
  • control flow (if/and/or)
  • logic (>/</eq?/not and co.)
  • [-] func to define a function (global only?), lambda to make one on the fly
  • def, globally and locally
  • block? maybe?
  • print (works on everything, no need to ->string)
  • [-] lists/strings:
    • first
    • rest
    • most
    • last
    • reverse
    • length
    • concat/append
    • in? (membership for lists, substrings for strings)
  • [-] types:
    • any?/nil?
  • [-] higher-order functions
    • map! (i'm particularly excited about figuring out how to do this on the stack, though i'm sure it's quite a naive implementation)
    • reduce