shsms / tulisp Goto Github PK
View Code? Open in Web Editor NEWAn embeddable lisp interpreter written in Rust.
License: GNU General Public License v3.0
An embeddable lisp interpreter written in Rust.
License: GNU General Public License v3.0
Blocked by #67
Currently variables are bound dynamically, without tracking scope.
In the below example, there are two variable definitions for out
,
and printer
is declared to use the first out
. But when called
from the scope of the second out
, it uses the value of the second
out
.
(let* ((out 10)
(printer (lambda () (print (format "out is %s" out)))))
(funcall printer)
(let ((out 20))
(funcall printer)))
This needs to change, and variables need to follow lexical scoping.
A fix was added to handle these in: 915009c
This needs unit tests, so it doesn't break again.
Blocked by #58
equal
on symbols is currently broken, because the comparison is done by comparing names. When comparing symbols, it should instead fall back to using eq
.
Add a load function for loading and evaluating a file, like an import statement.
To identify if a symbol is bound to a value (in the current context): https://www.gnu.org/software/emacs/manual/html_node/elisp/Void-Variables.html#index-boundp
This can be achieved by adding a span to the error at each step, as the error gets propagated out.
There are a lot of functions that need to implemented: https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequence-Functions.html
The currently implemented ones are listed here: https://docs.rs/tulisp/latest/tulisp/builtin/index.html#sequence-functions
This would allow back traces to show the correct files, for traces that span across multiple files.
It should be possible to have the same symbol with different spans. Right now, interned symbols get the span of the last occurrence of them in the code.
It could be implemented by giving unique ids to interned symbols, which sit inside the Rc
, therefore not mutable. And using those to identify and compare symbols.
(> 40 70 30)
should return nil
. But it returns t
.
<
, <=
, >=
have similar problems as well. These need to be fixed.
These are if-let
, when-let
and while-let
.
ref: https://www.gnu.org/software/emacs/manual/html_node/elisp/Conditionals.html
Because in tulisp
it appears to be.
It is currently implemented as a macro that rewrites the let*
expression with nested let
s. This is not optimal, and leads to unnecessary recursive calls in the interpreter.
In addition to the currently available setq
, we need a set
implementation (Primarily to be able to assign to dynamically created symbols).
https://www.gnu.org/software/emacs/manual/html_node/eintr/Using-set.html
They should always evaluate to themselves, and assignments to them should fail.
Ref: https://www.gnu.org/software/emacs/manual/html_node/elisp/Constant-Variables.html
They should take an array of tuples, like the constructor of a HashMap: https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#impl-From%3C%5B(K,+V);+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E
The pcase implementation: https://www.gnu.org/software/emacs/manual/html_node/elisp/pcase-Macro.html
And then the destructuring methods: https://www.gnu.org/software/emacs/manual/html_node/elisp/Destructuring-with-pcase-Patterns.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.