hippo

所属分类:编程语言基础
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2014-05-11 20:47:41
上 传 者sh-1993
说明:  一种玩具函数式编程语言
(A toy functional programming language)

文件列表:
ast/ (0, 2014-05-11)
ast/ast.go (1410, 2014-05-11)
ast/print.go (1031, 2014-05-11)
bin/ (0, 2014-05-11)
bin/sample.js (1722, 2014-05-11)
check/ (0, 2014-05-11)
check/builtins.go (3285, 2014-05-11)
check/checker.go (625, 2014-05-11)
check/checkfuncs.go (1994, 2014-05-11)
check/scope.go (4177, 2014-05-11)
gen/ (0, 2014-05-11)
gen/generator.go (1182, 2014-05-11)
gen/js.go (3655, 2014-05-11)
hippo.go (989, 2014-05-11)
lex/ (0, 2014-05-11)
lex/lexer.go (1917, 2014-05-11)
lex/lexfuncs.go (1744, 2014-05-11)
lex/pos.go (147, 2014-05-11)
lex/token.go (1071, 2014-05-11)
parse/ (0, 2014-05-11)
parse/errors.go (261, 2014-05-11)
parse/parsefuncs.go (4699, 2014-05-11)
parse/parser.go (1091, 2014-05-11)
sample.hippo (492, 2014-05-11)

Lanuage specification for hippo-lang ==================================== Hippo is a toy project i'm working on. It's a statically typed language with inspirations from lisp. Keywords -------- | keyword | description | | ------------- | -------------------------------- | | type | define a type | | func | define a function | Tokens ------ | type | token | | ------------- | -------------------------------- | | Colon | : | | OpenParen | ( | | CloseParen | ) | | Comment | # | Primitives ---------- | type | example | | ------------- | -------------------------------- | | string | "1" | | int | 1 | | float | 1.0 | Code sample ----------- ```lisp # type definition (type vec2 x:float y:float) # function definition (func dot:float v1:vec2 v2:vec2 (+ (* v1.x v2.x) (* v1.y v2.y))) # fibonacci function (func fib:int i:int (if (< i 2) 1 (+ (fib (- i 2)) (fib (- i 1))))) # pow operator (func ^:int i:int e:int (^' i i e)) (func ^':int v:int i:int e:int (if (= e 0) 1 (if (= e 1) v (^' (* v i) i (- e 1))))) # executed when running script (print (dot (vec2 1.0 1.0) (vec2 2.0 2.0))) (print (fib 10)) (print (^ 10 3)) ```

近期下载者

相关文件


收藏者