Closed obriencj closed 7 years ago
things that can be implemented as reader macros
this should allow for discarding the entire sibilant.ast
module, so long as I can ensure position information is stored in a lookaside during parsing.
the end result would be a stream plus a locations dict passed into a reader function which had a collection of reader macros. the reader function would use the macros is had available to parse and return a single expression.
compilation and execution could then happen, at which time more reader macros might be defined. subsequent reader calls would then operate with the new macros in place.
(set-macro-character "{" handler_fn)
where handler_fn accepts parameters as (lambda (stream trigger_char) ...)
and returns a pair representing the form that it should evaluate as. The macro can read from stream to advance it as needed.
This relies on a function named "read" which connects to the reader and pulls in a single expression/unit/whatever
similar to the stepped way that compilation happens at the module level, where each top-level statement can modify the environment to add new compile-able forms and macros for the next expression
support reader macros such that additional behavior can be grafted on.
move existing reader behavior into reader macros as possible!