diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 85 |
1 files changed, 43 insertions, 42 deletions
@@ -3,32 +3,32 @@ Interpreted Toy Programming Language written in Go --> # Mana -Mana is a toy programming language written in Go. It is a dynamically typed, interpreted language with a C-like syntax. +Mana is a toy programming language written in Go. It is a dynamically typed, interpreted language with a C-like syntax. -> *Note*: The language is still in development and is not yet usable. The documentation below is a work in progress and is subject to change. +> _Note_: The language is still in development and is not yet usable. The documentation below is a work in progress and is subject to change. ## Development Roadmap -| Implementation | Status | Specification | Example | Tests | -| --- | --- | --- | --- | --- | -| `LetStatement` | ✔️ | Let Statements are used to declare variables | `let x = 5;` | ✔️ | -| `ReturnStatement` | ✔️ | Return Statements are used to return values from functions | `return 5;` | ✔️ | -| `ExpressionStatement` | ✔️ | Expression Statements are used to evaluate expressions | `5 + 5;` | ✔️ | -| `IdentifierExpression` | ✔️ | Identifier Expressions are used to reference variables | `x` | ✔️ | -| `IntegerLiteralExpression` | ✔️ | Integer Literal Expressions are used to represent integer values | `5` | ✔️ | -| `PrefixExpression` | ✔️ | Prefix Expressions are used to represent prefix operators | `!true` | ✔️ | -| `InfixExpression` | ✔️ | Infix Expressions are used to represent infix operators | `5 + 5` | ✔️ | -| `BooleanLiteralExpression` | ✔️ | Boolean Literal Expressions are used to represent boolean values | `true` | ✔️ | -| `IfExpression` | ✔️ | If Expressions are used to represent conditional statements | `if (true) { return 5; }` | ✔️ | -| `BlockStatement` | ✔️ | Block Statements are used to represent blocks of code | `{ let x = 5; return x; }` | ✔️ | -| `FunctionLiteralExpression` | ✔️ | Function Literal Expressions are used to represent function definitions | `fn(x) { return x; }` | ✔️ | -| `CallExpression` | ✔️ | Call Expressions are used to call functions | `add(5, 5)` | ✔️ | -| `StringLiteralExpression` | NYI | String Literal Expressions are used to represent string values | `"Hello, World!"` | NYI | -| `ArrayLiteralExpression` | NYI | Array Literal Expressions are used to represent array values | `[1, 2, 3]` | NYI | -| `IndexExpression` | NYI | Index Expressions are used to index into arrays | `myArray[0]` | NYI | -| `HashLiteralExpression` | NYI | Hash Literal Expressions are used to represent hash values | `{"key": "value"}` | NYI | - -\**NYI = Not Yet Implemented* +| Implementation | Status | Specification | Example | Tests | +| --------------------------- | ------ | ----------------------------------------------------------------------- | -------------------------- | ----- | +| `LetStatement` | ✔️ | Let Statements are used to declare variables | `let x = 5;` | ✔️ | +| `ReturnStatement` | ✔️ | Return Statements are used to return values from functions | `return 5;` | ✔️ | +| `ExpressionStatement` | ✔️ | Expression Statements are used to evaluate expressions | `5 + 5;` | ✔️ | +| `IdentifierExpression` | ✔️ | Identifier Expressions are used to reference variables | `x` | ✔️ | +| `IntegerLiteralExpression` | ✔️ | Integer Literal Expressions are used to represent integer values | `5` | ✔️ | +| `PrefixExpression` | ✔️ | Prefix Expressions are used to represent prefix operators | `!true` | ✔️ | +| `InfixExpression` | ✔️ | Infix Expressions are used to represent infix operators | `5 + 5` | ✔️ | +| `BooleanLiteralExpression` | ✔️ | Boolean Literal Expressions are used to represent boolean values | `true` | ✔️ | +| `IfExpression` | ✔️ | If Expressions are used to represent conditional statements | `if (true) { return 5; }` | ✔️ | +| `BlockStatement` | ✔️ | Block Statements are used to represent blocks of code | `{ let x = 5; return x; }` | ✔️ | +| `FunctionLiteralExpression` | ✔️ | Function Literal Expressions are used to represent function definitions | `fn(x) { return x; }` | ✔️ | +| `CallExpression` | ✔️ | Call Expressions are used to call functions | `add(5, 5)` | ✔️ | +| `StringLiteralExpression` | ✔️ | String Literal Expressions are used to represent string values | `"Hello, World!"` | NYI | +| `ArrayLiteralExpression` | NYI | Array Literal Expressions are used to represent array values | `[1, 2, 3]` | NYI | +| `IndexExpression` | NYI | Index Expressions are used to index into arrays | `myArray[0]` | NYI | +| `HashLiteralExpression` | NYI | Hash Literal Expressions are used to represent hash values | `{"key": "value"}` | NYI | + +\*_NYI = Not Yet Implemented_ ## REPL @@ -72,10 +72,10 @@ fn subtract(x, y) { } // this will either add x and y if x is less than y, or return the difference between x and y -let result = if (x < y) { - add(x, y) -} else { - subtract(x, y) +let result = if (x < y) { + add(x, y) +} else { + subtract(x, y) }; // result = 15 ``` @@ -83,30 +83,30 @@ let result = if (x < y) { Mana is a dynamically typed language. This means that the type of a variable is determined at runtime. The following are the types that Mana supports: -| Type | Description | Example | -| --- | --- | --- | -| `Integer` | A 64-bit signed integer | `5` | -| `Boolean` | A boolean value | `true` | +| Type | Description | Example | +| --------- | ----------------------- | ------- | +| `Integer` | A 64-bit signed integer | `5` | +| `Boolean` | A boolean value | `true` | ## Operators Mana supports the following operators: -| Operator | Description | Example | -| --- | --- | --- | -| `+` | Addition | `5 + 5` | -| `-` | Subtraction | `5 - 5` | -| `*` | Multiplication | `5 * 5` | -| `/` | Division | `5 / 5` | -| `!` | Logical NOT | `!true` | -| `<` | Less Than | `5 < 5` | -| `>` | Greater Than | `5 > 5` | -| `==` | Equal To | `5 == 5` | -| `!=` | Not Equal To | `5 != 5` | +| Operator | Description | Example | +| -------- | -------------- | -------- | +| `+` | Addition | `5 + 5` | +| `-` | Subtraction | `5 - 5` | +| `*` | Multiplication | `5 * 5` | +| `/` | Division | `5 / 5` | +| `!` | Logical NOT | `!true` | +| `<` | Less Than | `5 < 5` | +| `>` | Greater Than | `5 > 5` | +| `==` | Equal To | `5 == 5` | +| `!=` | Not Equal To | `5 != 5` | ## Variables -Variables are declared using the `let` keyword. The variable name is followed by an equals sign and an expression. The expression is evaluated and the result is assigned to the variable. +Variables are declared using the `let` keyword. The variable name is followed by an equals sign and an expression. The expression is evaluated and the result is assigned to the variable. ```rust let x = 5; @@ -173,4 +173,5 @@ go test -v ./... ``` ## License + This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. |
