Sven Vogel edcfbea81d | ||
---|---|---|
.vscode | ||
src | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
README.md | ||
prog.vsasm | ||
test.erpn |
README.md
Yard
Yard is an funny programming language compiler and interpreter written in pure Rust.
Its a functional language, having no concept of classes or inheritance. Types are static and must be known at compile time.
It contains features such as:
- a COMEFROM keyword (inverse goto)
- a
don't
code block which never executes - no if. only
unless
, an inverted version of if. Meaning a block gets executed if the expression is false - three spaces start a single line comment
- many ways of making comments:
// comment
,:REM: comment
,# comment
,-- comment --
cuz we can
Keywords
Syntax | Description | Example |
Unless | Inverted if. Only executes the following block if the expression is false |
|
Loop | While(true)-Loop. Loops forever until either yield, ret, break are used. Loop take no boolean expression. |
|
cont | Short form for “continue”. Jumps to the next iteration of a loop | |
break | Exits a loop immediately | |
yield | Returns from a function with an argument as return value |
|
ret | Short form for “return”. This keyword takes no argument and returns from a function. NOTE: if ret is used in a function with a return type, an error occurs. | |
please | Decides on runtime wether a block should be executed or not. |
|
Example code
foo(bar: int, abc:int) = int {
bar + abc
}
main {
foo(4, 5)
}