Skip to content

Crtrpt/monkeygo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a handy language

 ___ ___ (o o) (o o) ( V ) monkeygo ( V ) --m-m--------------m-m-- 

Go

特性

  • 整数 integers
  • 布尔类型 bools
  • 字符串 strings
  • 数组 arrays
  • 哈希 maps
  • 前缀中缀索引操作符 prefix-, infix- and index operators
  • 条件 conditionals
  • 环境作用域 global and local binding
  • first-class functions
  • 返回语句 return statements
  • 闭包 closures

示例

let five = 5; let ten = 10; let add = fn(x, y) { x + y; }; let result = add(five, ten); "foobar" "foo bar" [1, 2]; {"foo": "bar"} macro(x, y) { x + y; }; 

特性

如何运行

暂不提供二进制版本 请源码运行

go run main.go 

语法参考 测试用例 和源码

性能测试

go build -o fib.exe ./benchmark fib.exe -engine=eval engine=eval, result=9227465, duration=25.4982916s fib.exe -engine=vm engine=vm, result=9227465, duration=8.8899446s 

对比其他语言

engine=vm, result=9227465, duration=8.8550264s engine=eval, result=9227465, duration=25.0208868s engine=python, result=9227465, duration=1.943023920059204 engine=nodejs, result=9227465, duration=0.06599998474121094 

差距很明显

需要做的

  • 抄袭golang 三色标记 gc
  • 学习 llvm 增加 aot 和jit模式
  • 文档
  • 包管理

有用的资源

About

用go实现一个语言

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages