ganyariya / go_monkey

Go 言語でつくるインタプリタ の ganyariya の実装

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐒 go_monkey

Go 言語でつくるインタプリタ の ganyariya の実装です。

Zenn Scrap

🐒 実行方法

git clone https://github.com/ganyariya/go_monkey.git
cd go_monkey
go run ./main.go
❯ go run ./main.go
Hello ganariya! This is the Monkey Programming Language!
>> let adder = fn (x) { fn (y) { x + y }};    
fn(x) {
fn(y)(x + y)
}
>> let two = adder(2)
fn(y) {
(x + y)
}
>> two(10)
12
>> let unless = macro(condition, consequence, alternative) { quote(if (!(unquote(condition))) { unquote(consequence); } else { unquote(alternative); }); };
>> unless(10 > 5, puts("not greater"), puts("greater"))
greater

🐒 History

About

Go 言語でつくるインタプリタ の ganyariya の実装


Languages

Language:Go 100.0%Language:Makefile 0.0%