Aryadev Chavali
bbb66d5fb1
string: new string library
...
Strings are simply byte vectors. We want a separate type so when
tagging/untagging we can have some level of type separation.
2026-03-05 19:44:58 +00:00
Aryadev Chavali
b93042fd27
lisp: INT -> SMI
...
when we implement big integer support, we should use INT there
instead. SMI signals intent much better.
2026-03-05 19:41:16 +00:00
Aryadev Chavali
a50ca72b24
lisp: 63 bit -> 56 bit SMI
...
This massively simplifies the tagging implementation as all types now
have a 1 byte tag. However, this does make the need for Big Integers
much greater as we've lost 8 bits of precision.
2026-03-05 18:36:43 +00:00
Aryadev Chavali
7f2dcc3ad2
alisp.org: mark TODOs
2026-03-05 17:32:52 +00:00
Aryadev Chavali
4bc615ab29
lisp_print: print verbose logs for lisp types on VERBOSE_LOGS=2
2026-03-05 17:32:52 +00:00
Aryadev Chavali
fc602f1664
allocator: free_list -> free_vec
2026-03-05 17:32:52 +00:00
Aryadev Chavali
30a87d4a1b
some small updates
2026-03-05 17:32:52 +00:00
Aryadev Chavali
9940651ac0
alloc: arena_t -> alloc_t
...
arena_t doesn't really make sense given we also have a free list.
Better to name it generic.
2026-03-05 17:32:52 +00:00
Aryadev Chavali
be0a6dd0c8
allocator: arena_make now takes nodes off the free list first.
2026-03-05 17:32:52 +00:00
Aryadev Chavali
9a91511e48
sys: plug in allocator
2026-03-05 17:32:52 +00:00
Aryadev Chavali
f9a044f631
allocator: implement a basic allocator
2026-03-05 17:32:52 +00:00
Aryadev Chavali
0e75b541df
vec: vec_try_append
...
Essentially a method to attempt to append data but without doing any
reallocation - stay within the bounds of the capacity.
2026-03-05 17:32:52 +00:00
Aryadev Chavali
e6e501c5a3
lisp: tag_generic, tag_sizeof, and lisp_sizeof
2026-03-05 17:32:52 +00:00
Aryadev Chavali
a79f60a203
lisp: split lisp into lisp and sys
...
Generic definition of tagged pointers, along with simple
constructor/destructors should be in lisp.h for use by other headers.
sys.h on the other hand contains all the general system methods.
2026-03-05 17:32:52 +00:00
Aryadev Chavali
79f53c7916
alisp.org: rework TODOs, setup one for allocators.
2026-02-12 23:03:05 +00:00
Aryadev Chavali
042cc48e8c
lisp: split memory into its own structure
2026-02-12 22:51:29 +00:00
Aryadev Chavali
b51aaa3d65
lisp: replace sys_register with sys_alloc
...
Allows us to abstract allocation away, creating Lisps automatically.
2026-02-12 22:51:29 +00:00
Aryadev Chavali
6499a9dd6d
lisp: combine tag.h into lisp.h
2026-02-12 22:51:29 +00:00
Aryadev Chavali
c1cdb8607d
lisp: split memory into conses and vectors
...
During garbage collection, we'll iterate through these two vectors.
Instead of freeing the memory, we can swap cells in the vector and
decrement its size.
The idea is we can attach an allocator to the system where we reuse
memory instead of just allocating everytime.
2026-02-12 22:51:29 +00:00
Aryadev Chavali
7df292ed9e
alisp.org: mark WIP -> TODO
2026-02-11 10:31:23 +00:00
Aryadev Chavali
4aad62fec9
alisp.org: update
2026-02-11 10:29:57 +00:00
Aryadev Chavali
a4fb48a863
reader: implement read_vec and setup errors for random closed brackets
2026-02-11 10:29:57 +00:00
Aryadev Chavali
5f05a6a108
lisp: implement TAG_VEC lisp_print method
2026-02-11 10:29:57 +00:00
Aryadev Chavali
e60a7459e0
reader: fix issue with read_list of infinite loop
2026-02-11 10:29:57 +00:00
Aryadev Chavali
4936460b39
reader: factor out read_negative
2026-02-11 10:29:57 +00:00
Aryadev Chavali
04be0ecad0
alisp.org: update todos
2026-02-11 10:29:57 +00:00
Aryadev Chavali
f09e0d33a4
reader: deal with negative prefix numbers in read
2026-02-11 10:29:57 +00:00
Aryadev Chavali
d1d0783fc3
reader: implement read_int
2026-02-11 10:29:57 +00:00
Aryadev Chavali
21254e77bf
tag: INT_MAX/INT_MIN are now i64 by default
2026-02-11 10:29:57 +00:00
Aryadev Chavali
e772b06ae5
main: rearrange code and setup prototypes
2026-02-11 10:29:57 +00:00
Aryadev Chavali
eca46069f8
main: print out expressions from reading
2026-02-11 10:29:57 +00:00
Aryadev Chavali
c2f1835b4c
main: factor out the stream init code into its own function
2026-02-11 10:29:57 +00:00
Aryadev Chavali
93a52db7cc
alisp.org: add TODO about reader macros
2026-02-11 10:29:57 +00:00
Aryadev Chavali
d88bc2baeb
alisp.org: mark some TODOs
2026-02-11 10:29:57 +00:00
Aryadev Chavali
2dc0c6080e
reader: deal with quotes
...
This is currently implemented as a parse-time primitive. Scheme
doesn't seem to have reader macros (which is INSANE) but Common Lisp
does. We'll need to add a TODO about this.
2026-02-11 10:29:57 +00:00
Aryadev Chavali
8e81e6f762
reader: at every iteration of read_all, skip comments and whitespace
2026-02-11 10:29:57 +00:00
Aryadev Chavali
a49492b27f
stream: clean up
2026-02-11 10:29:57 +00:00
Aryadev Chavali
8b2fe97fc2
lisp: sys_cost for memory footprint
2026-02-11 10:29:57 +00:00
Aryadev Chavali
ff512986f8
symtable: sym_table_cost
...
Useful for figuring out the rough memory footprint (actually utilised)
by the symbol table.
2026-02-11 10:29:57 +00:00
Aryadev Chavali
47f33cb969
tag: make function inputs constant
2026-02-11 10:29:57 +00:00
Aryadev Chavali
39e5b76f8b
lisp: lisp_print
2026-02-11 10:29:57 +00:00
Aryadev Chavali
b91e79933b
symtable: refactor for SV changes and propagate
2026-02-11 10:29:57 +00:00
Aryadev Chavali
3e7734037c
sv: rearrange sv_substr and sv_truncate
2026-02-11 10:29:57 +00:00
Aryadev Chavali
9f3bb57972
sv: major refactor
...
- Internal data pointer is read only by default => any uses that
require use of the pointer itself (freeing, mutating) must perform a
cast.
- refactor tests to use some new sv macros and functions, and clean
them up.
- slight cleanup of sv.c
2026-02-11 10:29:57 +00:00
Aryadev Chavali
b646ae3f7e
sv: fix sv_substr
...
Issue I came up with when looking at the code, based on
sv_chop_right's impl. Why do we keep this function around again?
2026-02-11 10:29:57 +00:00
Aryadev Chavali
818d4da850
sv: SV_AUTO macro (for literal strings/literal byte arrays really).
2026-02-11 10:29:57 +00:00
Aryadev Chavali
daa1d3d565
lisp: add and implement lisp_free_rec
...
May be useful for testing.
2026-02-11 10:29:57 +00:00
Aryadev Chavali
b7fc5170b0
reader: implement read_sym and read_list
...
To be tested properly.
2026-02-11 10:29:57 +00:00
Aryadev Chavali
d02174ea8b
Makefile: add reader to units to compile
2026-02-11 10:29:57 +00:00
Aryadev Chavali
7ef6905d7a
main: fit reader into main.
2026-02-11 10:29:57 +00:00