ref: 661dfb97c43f8b120ac8165aada466e2038b01eb
parent: a2a0c55c3cce244a44b21cbb3f7c01d8b48becd6
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Dec 30 13:08:27 EST 2024
gen.lsp: a bit more docs
--- a/flisp.boot
+++ b/flisp.boot
@@ -16,7 +16,7 @@
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #fn("8000z0700}2:" #(aref)) 0 0)
*properties* #table(*funvars* #table(lz-unpack ((data :to destination)
(data :size decompressed-bytes)) void? ((x)) length= ((lst
- n)) help ((term)) void (rest) *prompt* (nil) lz-pack ((data (level 0))) vm-stats (nil) car ((lst)) cdr ((lst))) *doc* #table(cdr "Returns the tail of a list or nil if not available." lz-unpack "Return decompressed data previously compressed using lz-pack.\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." void? "Return #t if x is #<void> and #f otherwise." length= "Bounded length test.\nUse this instead of (= (length lst) n), since it avoids unnecessary\nwork and always terminates." help "Display documentation for the specified term, if available." void "Return the constant #<void> while ignoring any arguments.\n#<void> is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though #t or nil could\nbe returned instead, in case of #<void> alone, REPL will not print\nit." *prompt* "Function called by REPL to signal the user input is required.\nDefault function prints \"#;> \"." lz-pack "Return data compressed using Lempel-Ziv.\nThe data must be an array, returned value will have the same type.\nThe optional level is between 0 and 10. With level 0 a simple LZSS\nusing hashing will be performed. Levels between 1 and 9 offer a\ntrade-off between time/space and ratio. Level 10 is optimal but very\nslow." vm-stats "Print various VM-related information, such as the number of GC calls\nso far, heap and stack size, etc." car "Returns the first element of a list or nil if not available." *builtins* "VM instructions as closures." *properties* "All properties of symbols recorded with putprop are recorded in this table."))
+ n)) help ((term)) void (rest) *prompt* (nil) lz-pack ((data (level 0))) cons? ((value)) vm-stats (nil) * ((number…)) car ((lst)) cdr ((lst)) + ((number…))) *doc* #table(lz-unpack "Return decompressed data previously compressed using lz-pack.\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." void? "Return #t if x is #<void> and #f otherwise." length= "Bounded length test.\nUse this instead of (= (length lst) n), since it avoids unnecessary\nwork and always terminates." help "Display documentation for the specified term, if available." car "Returns the first element of a list or nil if not available." *builtins* "VM instructions as closures." void "Return the constant #<void> while ignoring any arguments.\n#<void> is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though #t or nil could\nbe returned instead, in case of #<void> alone, REPL will not print\nit." arg-counts "VM instructions mapped to their expected arguments count." *prompt* "Function called by REPL to signal the user input is required.\nDefault function prints \"#;> \"." lz-pack "Return data compressed using Lempel-Ziv.\nThe data must be an array, returned value will have the same type.\nThe optional level is between 0 and 10. With level 0 a simple LZSS\nusing hashing will be performed. Levels between 1 and 9 offer a\ntrade-off between time/space and ratio. Level 10 is optimal but very\nslow." Instructions "VM instructions mapped to their encoded byte representation." cons? "Returns #t if the value is a cons cell." vm-stats "Print various VM-related information, such as the number of GC calls\nso far, heap and stack size, etc." * "Return product of the numbers or 1 with no arguments." cdr "Returns the tail of a list or nil if not available." + "Return sum of the numbers or 0 with no arguments." *properties* "All properties of symbols recorded with putprop are recorded in this table."))
*runestring-type* (array rune) *string-type* (array byte)
*syntax-environment* #table(unwind-protect #fn("A000n220502050218722q1e3e2e1232402286e12587e12686e2e3e3e387e1e3e3:" #(#fn(gensym)
let λ prog1 trycatch begin raise)) help #fn(";000n17002152853W072855147350424250>170026q535247350@B0722728051524735047960:" #(getprop
binary files a/flisp.boot.builtin b/flisp.boot.builtin differ
--- a/gen.lsp
+++ b/gen.lsp
@@ -20,7 +20,8 @@
OP_SETA seta #f 0 ()
OP_JMP jmp #f 0 ()
OP_LOADC0 loadc0 #f 0 ()
- OP_CONSP cons? 1 (λ (x) (cons? x)) ()
+ OP_CONSP cons? 1 (λ (x) (cons? x)) (
+ ((value) "Returns #t if the value is a cons cell."))
OP_BRNE brne #f 0 ()
OP_LOADT loadt #f 0 ()
OP_LOAD0 load0 #f 0 ()
@@ -57,9 +58,11 @@
OP_EQUAL equal? 2 (λ (x y) (equal? x y)) ()
OP_LIST list ANYARGS (λ rest rest) ()
OP_APPLY apply -2 (λ rest (apply apply rest)) ()
- OP_ADD + ANYARGS (λ rest (apply + rest)) ()
+ OP_ADD + ANYARGS (λ rest (apply + rest)) (
+ ((number…) "Return sum of the numbers or 0 with no arguments."))
OP_SUB - -1 (λ rest (apply - rest)) ()
- OP_MUL * ANYARGS (λ rest (apply * rest)) ()
+ OP_MUL * ANYARGS (λ rest (apply * rest)) (
+ ((number…) "Return product of the numbers or 1 with no arguments."))
OP_DIV / -1 (λ rest (apply / rest)) ()
OP_IDIV div0 2 (λ rest (apply div0 rest)) ()
OP_NUMEQ = 2 (λ (x y) (= x y)) ()
@@ -155,12 +158,21 @@
(io-write c-code "};\n")
(io-close c-code)
- (write `(define Instructions ,e) instructions)
+ (write `(define Instructions
+ "VM instructions mapped to their encoded byte representation."
+ ,e)
+ instructions)
(io-write instructions "\n\n")
- (write `(define arg-counts ,ac) instructions)
+ (write `(define arg-counts
+ "VM instructions mapped to their expected arguments count."
+ ,ac)
+ instructions)
(io-write instructions "\n")
(io-close instructions)
(set! lms (cons vector (reverse! lms)))
- (write `(define *builtins* "VM instructions as closures." ,lms) builtins)
+ (write `(define *builtins*
+ "VM instructions as closures."
+ ,lms)
+ builtins)
(io-write builtins "\n")
(io-close builtins)))
--
⑨