An embeddable Lisp with dynamic typing and a basic expression-level interpreter.
The alternative backend is a WIP emitter that enables direct JVM bytecode serialization. In this case, forms may either be opcodes or predefined constructs like labels. The bytecode is aligned with class file directives/attributes and validated with javap
. Refer to emit.cc.
OpenJDK uses the ASM Java package for working with class files, which is ideal.
Forms represent both structural and semantic constructs, which is what makes lisps more unique than mainstream PL design.
-
def
for defining variables (usesstd::unordered_map
) -
set
as the default assignment form (mutable-by-default) -
debug
is an alias for printing values tostd::cout
-
+
,-
,*
,/
expressions with left-reduce accumulators -
if
conditional expression (optional else clause) -
fun
declarations for named functions with local context
In the evaluation loop, non-terminals are forward definitions and terminals are recursively evaluated (e.g. forms for binary operations), implying that a def
may not be assigned to a def
since terminals do not return an expr_value
.
Clone this repository, run make
and link with build/libflisp.a
. All sources and headers are in src
.
A more-detailed overview of flisp's forms can be found at main.lsp
.
- Embed callable C++ expressions into the interpreter
- Skip expression parse tree when serializing to JVM bytecode
- Introduce static typing (Hindley-Milner) & FP constructs
- Replace expression-level interpreter with register-based VM
- Basic macros with recursion & templating/metaprogramming
On a sidenote, flisp is a WIP and not ready for usage at this point.