动态类型的编程语言:Mochi

jopen 10年前

Mochi是一个动态类型的编程语言,用于函数式编程和actor风格的编程。

它的解析器采用Python3编写。这个解析器将一个采用Mochi编写的程序转换成Python3的AST / bytecode。

特性

  • 类似于Python的语法
  • Tail recursion optimization (self tail recursion only), and no loop syntax
  • Re-assignment are not allowed in function definition.
  • Basic collection type is a persistent data structure. (using Pyrsistent)
  • Pattern matching / Data types, like algebraic data types
  • Pipeline operator
  • Syntax sugar of anonymous function definition
  • Actor, like the actor of Erlang(using Eventlet)
  • Macro, like the traditional macro of Lisp
  • Builtin functions includes functions exported by itertools module, recipes, functools module and operator module

示例

Factorial    def factorial(n, m):      if n == 1:          m      else:          factorial(n - 1, n * m)      factorial(10000, 1)  # => 28462596809170545189064132121198688...    # Or    def factorial:      n: factorial(n, 1)      0, acc: acc      n, acc: factorial(n - 1, acc * n)    factorial(10000)  # => 28462596809170545189064132121198688...

项目主页:http://www.open-open.com/lib/view/home/1418651539823

</strong>