mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-17 15:54:07 +10:00
Starting fiddling with the docs site proper
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
# Introduction
|
||||
|
||||
[](https://github.com/Ratstail91/Toy/actions/workflows/continuous-integration-v2.yml)
|
||||
|
||||
The Toy Programming Language is an imperative, bytecode-interpreted, embeddable scripting language. Rather than functioning independently, it serves as part of another program, the "host". This design allows for straightforward customization by both the host's developers and end users, achieved by exposing program logic through text files.
|
||||
|
||||
The reference implementation can be found on [GitHub](https://github.com/Ratstail91/Toy).
|
||||
|
||||
[Reserved Words](reserved-words.md)
|
||||
[Operators](operators.md)
|
||||
[Types](types.md)
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Operators
|
||||
|
||||
The following table lists the recognized operators, and their uses.
|
||||
|
||||
| Symbol | Description |
|
||||
| --- | --- |
|
||||
| `+` | Add. |
|
||||
| `-` | Subtract. |
|
||||
| `*` | Multiply. |
|
||||
| `/` | Divide. |
|
||||
| `%` | Modulo. |
|
||||
| `=` | Assign. |
|
||||
| `+=` | Add Assign. |
|
||||
| `-=` | Subtract Assign. |
|
||||
| `*=` | Multiply Assign. |
|
||||
| `/=` | Divide Assign. |
|
||||
| `%=` | Modulo Assign. |
|
||||
| `++` | Increment. Not yet implemented. |
|
||||
| `--` | Decrement. Not yet implemented. |
|
||||
| `==` | Compare Equal. |
|
||||
| `!=` | Compare Not Equal. |
|
||||
| `<` | Compare Less. |
|
||||
| `<=` | Compare Less Equal. |
|
||||
| `>` | Compare Greater. |
|
||||
| `>=` | Compare Greater Equal. |
|
||||
| `(` `)` | Parenthesis. |
|
||||
| `[` `]` | Brackets. |
|
||||
| `{` `}` | Braces. |
|
||||
| `&&` | And. |
|
||||
| `\|\|` | Or. |
|
||||
| `!` | Not. |
|
||||
| `?` `:` | Ternary. |
|
||||
| `?` | Question. Not used. |
|
||||
| `:` | Colon. |
|
||||
| `.` | Dot. Not yet implemented. |
|
||||
| `..` | Concatenate. |
|
||||
| `...` | Rest. Not yet implemented. |
|
||||
| `&` | Ampersand. Not used. |
|
||||
| `\|` | Pipe. Not used. |
|
||||
|
||||
|
||||
20
docs/quick-start.md
Normal file
20
docs/quick-start.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Toy v2 Quick Start Guide
|
||||
|
||||
To help you start using Toy as fast as possible, here are the core elements of the language. Not everything available is listed, but this should give you a good starting point.
|
||||
|
||||
## Keyword 'print'
|
||||
|
||||
Firstly, the `print` keyword is used to output data to
|
||||
|
||||
## Keyword 'assert'
|
||||
|
||||
## Variables and Types
|
||||
|
||||
## Control Flow
|
||||
|
||||
## Functions
|
||||
|
||||
## External Libraries and Extending Toy
|
||||
|
||||
## Reserved Keywords & Operators
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# Reserved Words
|
||||
|
||||
The following list of words have special meaning to the language, so they can't be used as names for variables or functions.
|
||||
|
||||
```txt
|
||||
any
|
||||
array
|
||||
as
|
||||
assert
|
||||
bool
|
||||
break
|
||||
class
|
||||
const
|
||||
continue
|
||||
do
|
||||
else
|
||||
export
|
||||
false
|
||||
float
|
||||
fn
|
||||
function
|
||||
for
|
||||
foreach
|
||||
function
|
||||
if
|
||||
import
|
||||
in
|
||||
int
|
||||
null
|
||||
of
|
||||
opaque
|
||||
print
|
||||
return
|
||||
string
|
||||
table
|
||||
true
|
||||
type
|
||||
typeas
|
||||
typeof
|
||||
var
|
||||
while
|
||||
yield
|
||||
```
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
# Types
|
||||
|
||||
When a variable name is declared, you may specify what kind of value can be stored within - this is known as its "type". If you attempt to store a value of a different type, an error will be raised.
|
||||
|
||||
```toy
|
||||
//syntax
|
||||
var name: type = value;
|
||||
|
||||
//example
|
||||
var answer: int = 42;
|
||||
```
|
||||
|
||||
Specifying a type is optional, in which case, the type is set to `any` by default ([see below](#any)).
|
||||
|
||||
```toy
|
||||
//omit the type and set an integer value
|
||||
var answer = 42;
|
||||
|
||||
print typeof answer; // will print "any"
|
||||
```
|
||||
|
||||
You may access the type of a variable using the `typeof` keyword. Types can also act as values - the type of any type is `type`.
|
||||
|
||||
# null
|
||||
|
||||
The type `null` is a special case in the language, as it represents the absence of any meaningful value. It can't be specified as a variable's type, only as it's value.
|
||||
|
||||
Unlike the other types, the type of `null` is `null`.
|
||||
|
||||
# bool
|
||||
|
||||
The `bool` type can hold two meaningful values, either `true` or `false`.
|
||||
|
||||
# int
|
||||
|
||||
The `int` type can hold any whole number between `-2,147,483,648` and`2,147,483,647`, due to being stored as a signed 32-bit integer.
|
||||
|
||||
# float
|
||||
|
||||
The `float` type can hold a single-precision floating-point value as defined by IEEE 754, which is the most commonly used method for storing real numbers in 32 bits.
|
||||
|
||||
What this means in practice is that floating point errors are possible, but this is still the best option for managing decimal numbers.
|
||||
|
||||
# string
|
||||
|
||||
TODO
|
||||
|
||||
# array
|
||||
|
||||
TODO
|
||||
|
||||
# table
|
||||
|
||||
TODO
|
||||
|
||||
# function
|
||||
|
||||
TODO
|
||||
|
||||
# opaque
|
||||
|
||||
TODO
|
||||
|
||||
# type
|
||||
|
||||
TODO
|
||||
|
||||
# any
|
||||
|
||||
TODO
|
||||
|
||||
Reference in New Issue
Block a user