From cb441fd2ddedbb6762f5bd2a2fca2f6fb7d60931 Mon Sep 17 00:00:00 2001 From: kitty Date: Fri, 27 Feb 2026 17:03:30 +1100 Subject: VALUE, and make handler a value --- jefs.fs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'jefs.fs') diff --git a/jefs.fs b/jefs.fs index 18ea7e1..e80b1d7 100644 --- a/jefs.fs +++ b/jefs.fs @@ -3,6 +3,7 @@ \ :noname \ DO LOOP \ s\" +\ add error handling to compiling words \ \ argc/argv \ file io @@ -64,6 +65,10 @@ hex : ret, c3 c, ; decimal : endcase ' drop compile, begin ?dup while [compile] then repeat ; immediate \ }}} +: value create [compile] lit ret, ; +: to parse find drop >cfa 6 + state @ if + [compile] lit ' ! compile, else ! then ; immediate + \ TODO interpret mode strings? : s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, nip r> dup >resolve 4 + [compile] lit [compile] lit ; immediate : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " @@ -202,7 +207,7 @@ variable hld 2 of ." word not found" endof ." unknown error" endcase cr fuck ; -: _ ' (handler) handler ! ; _ \ i should do immediate ' at some point +: _ ' (handler) to handler ; _ \ i should do immediate ' at some point : >ffa ( lfa -- ffa ) 8 + ; : >nfa ( lfa -- nfa ) 9 + ; @@ -250,7 +255,7 @@ make file-buffer file-buffer-length allot : open-file ( mode zstr -- ?fd flag ) 0 -rot sysopen errno ; : close-file ( fd -- flag ) sysclose errno-flag ; : read-file ( c-addr u fd -- ?u flag ) >r swap r> sysread errno ; -: write-file ( c-addr u fd -- ?u flag ) >r swap r> syswrite errno ; +: write-file ( c-addr u fd -- ?u flag ) >r swap r> syswrite errno ; \ }}} .free bye -- cgit v1.2.3