Update links in README.md
This commit is contained in:
parent
a36ff43555
commit
cab12e3833
50
README.md
50
README.md
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
# Omega
|
# Omega
|
||||||
|
|
||||||
- [What?](#What)
|
- [What?](#what)
|
||||||
- [Why?](#Why)
|
- [Why?](#why)
|
||||||
- [Who?](#Who)
|
- [Who?](#who)
|
||||||
- [License](#License)
|
- [License](#license)
|
||||||
- [Specification](#Table-of-Contents)
|
- [Specification](#table-of-contents)
|
||||||
|
|
||||||
## What?
|
## What?
|
||||||
Omega is a language intended for scripting purposes. Omega is reads `.omega` files which contain Omega-code (specified below), which will then be parsed into bytecode, which can be run instantly, or later through the interpreter.
|
Omega is a language intended for scripting purposes. Omega is reads `.omega` files which contain Omega-code (specified below), which will then be parsed into bytecode, which can be run instantly, or later through the interpreter.
|
||||||
@ -27,13 +27,13 @@ The Omega specification is simply [CC-BY-SA](http://creativecommons.org/licenses
|
|||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
Table of contents for the Omega spec
|
Table of contents for the Omega spec
|
||||||
- [Examples](#Examples)
|
- [Examples](#examples)
|
||||||
- [General syntax](#General-syntax)
|
- [General syntax](#general-syntax)
|
||||||
- [Expressions](#Expressions)
|
- [Expressions](#expressions)
|
||||||
- [Scopes](#Scopes)
|
- [Scopes](#scopes)
|
||||||
- [Conditions](#Conditions)
|
- [Conditions](#conditions)
|
||||||
- [Values](#Values)
|
- [Values](#values)
|
||||||
- [Keywords](#Keywords)
|
- [Keywords](#keywords)
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
Before any of the following examples, a print-function has been defined in the global scope. The print-function takes in a String-type as a parameter.
|
Before any of the following examples, a print-function has been defined in the global scope. The print-function takes in a String-type as a parameter.
|
||||||
@ -52,15 +52,15 @@ for (let i = 0; i < max; i++) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
## General Syntax
|
## General Syntax
|
||||||
The general syntax of Omega is fairly similar to that of [TypeScript](https://www.typescriptlang.org/) or [Rust](https://www.rust-lang.org/). The syntax is a mix of [keywords](#keywords) and [expressions](#Expressions) displayed such as in the [examples](#Examples).
|
The general syntax of Omega is fairly similar to that of [TypeScript](https://www.typescriptlang.org/) or [Rust](https://www.rust-lang.org/). The syntax is a mix of [keywords](#keywords) and [expressions](#expressions) displayed such as in the [examples](#examples).
|
||||||
|
|
||||||
## Expressions
|
## Expressions
|
||||||
Expressions are a set of [values](#Values), [function calls](#Function-calls) and [operators](#Operators) that Omega interprets and returns a new [value](#Values) out of.
|
Expressions are a set of [values](#values), [function calls](#function-calls) and [operators](#operators) that Omega interprets and returns a new [value](#values) out of.
|
||||||
|
|
||||||
For example `2 + 3` is an expression combined by a `+`-[operator](#Operators) which will result `5`
|
For example `2 + 3` is an expression combined by a `+`-[operator](#operators) which will result `5`
|
||||||
|
|
||||||
## Function calls
|
## Function calls
|
||||||
Function calls are also very similar to other languages. If there esists a function called `function_one`, it can be called with `function_one();`. If there exists a function called `function_two` which requires two i32's as arguments, it can be called as `function_two(5, 2);` where 5 and 2 are example [integer values](#Values).
|
Function calls are also very similar to other languages. If there esists a function called `function_one`, it can be called with `function_one();`. If there exists a function called `function_two` which requires two i32's as arguments, it can be called as `function_two(5, 2);` where 5 and 2 are example [integer values](#values).
|
||||||
- Function calls **must** have parenthesises in the end of them to signify the call, and after the parenthesis there must be a semicolon `;`.
|
- Function calls **must** have parenthesises in the end of them to signify the call, and after the parenthesis there must be a semicolon `;`.
|
||||||
- Any possible arguments must be given between the parenthesis separated by commas`,`.
|
- Any possible arguments must be given between the parenthesis separated by commas`,`.
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ Operators are a number of individual and combined symbols which together form me
|
|||||||
Examples:
|
Examples:
|
||||||
- `1++` returns 2
|
- `1++` returns 2
|
||||||
- `2++` returns 3
|
- `2++` returns 3
|
||||||
- Some operators are listed under [Conditions](#Conditions)
|
- Some operators are listed under [Conditions](#conditions)
|
||||||
|
|
||||||
## Scopes
|
## Scopes
|
||||||
Scopes are areas of code surrounded by brackets `{}`. E.g.
|
Scopes are areas of code surrounded by brackets `{}`. E.g.
|
||||||
@ -112,11 +112,11 @@ variable = this_is_scoped; // Exception! Cannot access inner-scope.
|
|||||||
As is visible in the example, variables defined in the scope are no longer accessible outside the scope. Scopes exist in their individual "environments", where they can access the variables in their upper scopes, but not inner scopes.
|
As is visible in the example, variables defined in the scope are no longer accessible outside the scope. Scopes exist in their individual "environments", where they can access the variables in their upper scopes, but not inner scopes.
|
||||||
|
|
||||||
## Conditions
|
## Conditions
|
||||||
Conditions are a special kind of [expression](#Expressions), which will return a `boolean` [value](#Values).
|
Conditions are a special kind of [expression](#expressions), which will return a `boolean` [value](#values).
|
||||||
|
|
||||||
Conditions may be simply `true` or `false`, or tests like `var`, where `var` is a `boolean`-type variable, or `name == "test"`, where `name` is a `string`-type variable.
|
Conditions may be simply `true` or `false`, or tests like `var`, where `var` is a `boolean`-type variable, or `name == "test"`, where `name` is a `string`-type variable.
|
||||||
|
|
||||||
Conditions can also be set as [values](#Values) for variables, since they explicitly return a `boolean` value.
|
Conditions can also be set as [values](#values) for variables, since they explicitly return a `boolean` value.
|
||||||
|
|
||||||
Operators for conditions are
|
Operators for conditions are
|
||||||
- `==` for equals.
|
- `==` for equals.
|
||||||
@ -142,7 +142,7 @@ There are a number of values you can assign to your variables, as of Omega 1.0,
|
|||||||
- `i64` (or usually long), a basic 64-bit integer value, such as `3` or `11`.
|
- `i64` (or usually long), a basic 64-bit integer value, such as `3` or `11`.
|
||||||
- `f32` (or usually float), a basic 32-bit float value, such as `1.5` or `6.32`.
|
- `f32` (or usually float), a basic 32-bit float value, such as `1.5` or `6.32`.
|
||||||
- `f64` (or usually double), a basic 64-bit float value, such as `1.5` or `6.32`.
|
- `f64` (or usually double), a basic 64-bit float value, such as `1.5` or `6.32`.
|
||||||
- `boolean`, contains value of `true` or `false`. This also includes [conditions](#Conditions).
|
- `boolean`, contains value of `true` or `false`. This also includes [conditions](#conditions).
|
||||||
|
|
||||||
## Keywords
|
## Keywords
|
||||||
The following keywords are specified to execute an action.
|
The following keywords are specified to execute an action.
|
||||||
@ -151,7 +151,7 @@ The following keywords are specified to execute an action.
|
|||||||
- [`def`](#def) defines a new function.
|
- [`def`](#def) defines a new function.
|
||||||
- [`while`](#while) initializes a scope which will be ran while a condition applies, which is specified after the `while`.
|
- [`while`](#while) initializes a scope which will be ran while a condition applies, which is specified after the `while`.
|
||||||
- [`for`](#for) initializes a scope which will be ran a number of times specified after the `for`.
|
- [`for`](#for) initializes a scope which will be ran a number of times specified after the `for`.
|
||||||
- [All operators](#Operators) are also somewhat considered as keywords.
|
- [All operators](#operators) are also somewhat considered as keywords.
|
||||||
|
|
||||||
#### `let`
|
#### `let`
|
||||||
Initializes a new variable, as such:
|
Initializes a new variable, as such:
|
||||||
@ -195,10 +195,10 @@ def third_function(param1: i32, param2: string) {
|
|||||||
- The parameters are divided by a comma`,`, after which there may be any number of whitespace.
|
- The parameters are divided by a comma`,`, after which there may be any number of whitespace.
|
||||||
- After the list of parameters there **must** be a closing bracket `)`.
|
- After the list of parameters there **must** be a closing bracket `)`.
|
||||||
- Between the parenthesis and the parameter-lists, there may be any number of whitespace.
|
- Between the parenthesis and the parameter-lists, there may be any number of whitespace.
|
||||||
- After the parenthesis and any number of whitespace, there must be a [scope definition](#Scopes).
|
- After the parenthesis and any number of whitespace, there must be a [scope definition](#scopes).
|
||||||
|
|
||||||
#### `while`
|
#### `while`
|
||||||
Defines a loop which will be as long as the [condition](#Conditions) defined after it is met.
|
Defines a loop which will be as long as the [condition](#conditions) defined after it is met.
|
||||||
```
|
```
|
||||||
while (true) {
|
while (true) {
|
||||||
// Runs infinitely.
|
// Runs infinitely.
|
||||||
@ -214,8 +214,8 @@ while (true == false) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
- To specify a while, the line **must** begin with a `while`.
|
- To specify a while, the line **must** begin with a `while`.
|
||||||
- After the `while`, there can be a number of whitespace, after which there **must** be parenthesis, within which (like parameters are in `def`), there must be a `boolean` [value](#Values) or otherwise known as a [condition](#Conditions).
|
- After the `while`, there can be a number of whitespace, after which there **must** be parenthesis, within which (like parameters are in `def`), there must be a `boolean` [value](#values) or otherwise known as a [condition](#conditions).
|
||||||
- After the parenthesis there must be a [scope definition](#Scopes).
|
- After the parenthesis there must be a [scope definition](#scopes).
|
||||||
|
|
||||||
#### `for`
|
#### `for`
|
||||||
Defines a loop very similar to while, but which parameters inside the parenthesis consists of three parts separated by semicolons`;`.
|
Defines a loop very similar to while, but which parameters inside the parenthesis consists of three parts separated by semicolons`;`.
|
||||||
|
Loading…
Reference in New Issue
Block a user