Egg-programming-language

所属分类:编程语言基础
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2018-03-21 07:59:06
上 传 者sh-1993
说明:  一种通用的高级数学和函数编程语言,为娱乐而创建。
(A general purpose high level mathematical and functional programming language created for fun.)

文件列表:
CONTRIBUTING.md (3883, 2018-03-21)
egg.js (9286, 2018-03-21)

# Egg A general purpose high level mathematical and functional programming language created for fun. ## Getting Started ``` clone the repository ``` ### Prerequisites What things you need to install the software and how to install them ``` Javascript ``` ## Built With * Javasciprt ## Contributing Please read [CONTRIBUTING.md] for details on our code of conduct, and the process for submitting pull requests to us. ## Authors * **Divyansh Dwivedi** - *Initial work* See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. ## License Currently this project is unclicensed ## Example ### Loop ```javascript run("do(define(total, 0),", " define(count, 1),", " while(<(count, 11),", " do(define(total, +(total, count)),", " define(count, +(count, 1)))),", " print(total))"); // -> 55 ``` ### Function ```javascript run(` do(define(plusOne, fun(a, +(a, 1))), print(plusOne(10))) `); // → 11 ``` ```javascript run(` do(define(pow, fun(base, exp, if(==(exp, 0), 1, *(base, pow(base, -(exp, 1)))))), print(pow(2, 10))) `); // → 1024 ``` ### Arrays ```javascript run(` do(define(sum, fun(array, do(define(i, 0), define(sum, 0), while(<(i, length(array)), do(define(sum, +(sum, element(array, i))), define(i, +(i, 1)))), sum))), print(sum(array(1, 2, 3)))) `); //-> 6 ``` ### Comments ```javascript console.log(parse("# hello\nx")); // → {type: "word", name: "x"} console.log(parse("a # one\n # two\n()")); // → {type: "apply", // operator: {type: "word", name: "a"}, // args: []} ``` ### Scope ```javascript run(` do(define(x, 4), define(setx, fun(val, set(x, val))), setx(50), print(x)) `); // → 50 //run(`set(quux, true)`); // → Some kind of ReferenceError ```

近期下载者

相关文件


收藏者