1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-01 06:18:05 +00:00

Modularize compiler.

This commit is contained in:
Calvin Rose
2018-07-01 11:52:15 -04:00
parent fde9751eab
commit f4fc4a0bcc
13 changed files with 1055 additions and 679 deletions

View File

@@ -1,11 +1,10 @@
# Example of dst bytecode assembly
# Fibonacci sequence, implemented with naive recursion.
(def fibasm (asm.asm '{
(def fibasm (asm '{
arity 1
bytecode [
(ldi 1 0x2) # $1 = 2
(lt 1 0 1) # $1 = $0 < $1
(ltim 1 0 0x2) # $1 = $0 < 2
(jmpif 1 :done) # if ($1) goto :done
(lds 1) # $1 = self
(addim 0 0 -0x1) # $0 = $0 - 1