nojima / nscheme Goto Github PK
View Code? Open in Web Editor NEWAn Implementation of Scheme
An Implementation of Scheme
GC を実装する。
Boehm GC を使う。
nscheme::Object
型の基底クラスを gc_cleanup
型にすれば良さそう?自力で mark-sweep を実装する。
used
フラグを false
にする。value_stack
, frame_stack
から再帰的にオブジェクトをたどっていく。見つかったオブジェクトの used
フラグを true
にする。used
が false
であるオブジェクトを delete する。2 で再帰する際に C のスタックを使うとスタックオーバーフローする可能性があるので注意。
自力で mark-compact を実装する。大変そう。
例:
#0=(a b c . #0#)
以下の手順でクラッシュする。
echo '(call/cc call/cc)' | ./nscheme
現在、一つの datum しか扱えないので、 datum の列をパースできるようにする。
また、toplevel における define の挙動をちゃんと実装する。
マクロを実装する準備として、変数の参照を名前ではなく index でできるようにする。
具体的には、変数を「現在のフレームからいくつ parent をたどるか」「指定したフレームの何番目の変数か」という 2 つの index で参照できるようにする。
また、LoadVariable
は LoadIndexVariable
と LoadNamedVariable
に分割する。
現在の VM は Inst 一つ一つにメモリを個別に割り当てているため、非常に効率が悪い。配列上に一列に並べるべき。
そろそろなんとかしたい。
define-syntax
を実装する。
define-syntax
はトップレベルにしか置けないという制約があるので、パース前に define-syntax
を拾ってきて解釈することもできるが、R7RS ではトップレベル以外にも置くことができ、場所によってマクロのスコープが変わる。R7RS に将来的に対応することを視野に入れると、パースと同時にマクロを展開したほうがよい。Transformer
を作る。
define-syntax
ひとつに対して Transformer
ひとつが対応する。Transformer
は書き換えルールを内部に保持し、与えられた S 式をルールによって変換することができる。Transformer
は実行時も保持する。
eval
のため。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.