EggJs-Playground

所属分类:代码编辑器
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2023-09-24 11:24:40
上 传 者sh-1993
说明:  Egg编程语言的网络编辑器,
(A web editor for Egg programming language,)

文件列表:
package-lock.json (717633, 2023-09-24)
package.json (951, 2023-09-24)
public/ (0, 2023-09-24)
public/Screnshots/ (0, 2023-09-24)
public/Screnshots/Code.png (67952, 2023-09-24)
public/Screnshots/Compile Error.png (42296, 2023-09-24)
public/Screnshots/Main.png (26676, 2023-09-24)
public/Screnshots/Parse Error.png (42928, 2023-09-24)
public/Screnshots/ParseTree.png (39667, 2023-09-24)
public/index.html (465, 2023-09-24)
src/ (0, 2023-09-24)
src/App.js (639, 2023-09-24)
src/assets/ (0, 2023-09-24)
src/assets/ArrowIcon.svg (7042, 2023-09-24)
src/components/ (0, 2023-09-24)
src/components/CodeEditor.jsx (1836, 2023-09-24)
src/components/Console.jsx (1747, 2023-09-24)
src/components/Header.jsx (1564, 2023-09-24)
src/components/InfoBox.jsx (4270, 2023-09-24)
src/components/ParseTree.jsx (1898, 2023-09-24)
src/components/ParseTreeMain.jsx (1290, 2023-09-24)
src/components/ParseTreeNode.jsx (1901, 2023-09-24)
src/context/ (0, 2023-09-24)
src/context/GlobalState.js (887, 2023-09-24)
src/index.css (1078, 2023-09-24)
src/index.js (255, 2023-09-24)
src/scripts/ (0, 2023-09-24)
src/scripts/evaluate.js (2835, 2023-09-24)
src/scripts/parse.js (1641, 2023-09-24)
src/scripts/run.js (840, 2023-09-24)

## EggJs Playground **EggJs Playground** is a web based editor for a primitive programming language **Egg** built using Javascript. Egg is featured as an example project in the book [Eloquent Javascript](https://eloquentjavascript.net/12_language.html) by Marjin Haverbeke. ### Screenshots --- ![Main](https://github.com/Krystal-G/EggJs-Playground/blob/main/public/Screnshots/Main.png) ![Code](https://github.com/Krystal-G/EggJs-Playground/blob/main/public/Screnshots/Code.png) ![ParseTree](https://github.com/Krystal-G/EggJs-Playground/blob/main/public/Screnshots/ParseTree.png) ![Parse Error](https://github.com/Krystal-G/EggJs-Playground/blob/main/public/Screnshots/Parse%20Error.png) ![Compile Error](https://github.com/Krystal-G/EggJs-Playground/blob/main/public/Screnshots/Compile%20Error.png) ### Some Things to Remember : --- * Everything is an expression in Egg. Even '+' or '-' which are operators in Javascript are treated as expressions. * Each expression in Egg would be an object. Thus, it would contain a type property, which would describe the type of the expression. * Type:- 'value' means strings or numbers. * Type:- 'word' means names of variables * Type:- 'apply' means applications, eg. if else blocks, while loops, etc. * All apply expressions have additional operator and args property. * Comment lines start with a '#' character ### Basic Syntax : --- * **print** * Description :- Prints the given value onto the console * Example :- _print('Hello World')_ * **define** * Description :- Defines a variable with the given name and assigns it a value * Example :- _define(x,10)_ * **set** * Description :- Changes the value of a previously declared variable * Example :- _set(x,11)_ * **if** * Description :- Conditional statement. Takes 3 arguments - condition, expression to execute if true, expression to execute if false * Example :- _if(<(x,5),print('small'), print('large'))_ * **array** * Description :- Creates an array with the specified elements * Example :- _define(arr, array(1,2,3))_ * **length** * Description :- Returns the length of an array * Example :- _length(arr)_ * **element** * Description :- Returns the element at specified index in array. Throws an error if index out of bounds * Example :- _element(arr, 0)_ * **do** * Description :- Defines a block of code. * Example :- _do(define(arr, array(1,2,3)), print(element(arr, 0)))_ * **while** * Description :- Defines a while loop with condition and a loop body * Example :- _while(>(x,0), do(print(x), set(x, -(x,1))))_ * **func** * Description :- Defines a function with arguments and a body. Arguments are separated by commas and the last expression is body * Example :- _func(a,b,print(+(a,b)))_

近期下载者

相关文件


收藏者