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
Aryadev Chavali
c12f4b2d2c
reader: some work done on basic API
2026-02-11 10:29:57 +00:00
Aryadev Chavali
b8d0ee2c7f
.dir-locals: added compile-command for testing
...
When I'm writing unit test code, it's nicer to compile with full logs
by default.
2026-02-09 09:57:46 +00:00
Aryadev Chavali
fe727d75e4
remove breaks after return in switch-case
2026-02-09 09:57:04 +00:00
Aryadev Chavali
06a4eafbb9
stream: optimise stream_substr_abs, stream_till, stream_while
...
In the base cases of STRINGS and FILES, these functions should be very
quick (operating on stuff in memory), and amortized for pipes.
2026-02-09 09:57:04 +00:00
Aryadev Chavali
fc5a6eb8fb
stream: refactor stream_seek_forward for changes in FILE API
2026-02-09 09:57:04 +00:00
Aryadev Chavali
5c7fb0fabd
stream: stream_stop -> stream_free
2026-02-09 09:57:04 +00:00
Aryadev Chavali
f164427b47
stream: stream_reset
...
We can reuse the same stream by resetting it. We don't delete the
cached data.
2026-02-09 09:57:04 +00:00
Aryadev Chavali
2238f348e1
stream: stream_line_col includes current position in computation
2026-02-09 09:57:04 +00:00
Aryadev Chavali
f56a59ff7a
stream: STREAM_TYPE_FILE will now read file upfront
...
No more having to chunk read - if ~stream_init_file~ is used, the
constructor slurps the entire file into the cache. This pays up front
for a bunch of checks essentially.
~stream_init_pipe~ should be used for chunked reading.
2026-02-09 09:57:04 +00:00
Aryadev Chavali
6a54c54bfb
stream: a bit of tidying up
2026-02-09 09:57:04 +00:00
Aryadev Chavali
2855536bdd
stream: a few further refactors due to new sv functions
2026-02-09 09:57:04 +00:00