Yard is an funny programming language compiler written in pure Rust
Go to file
Sven Vogel ee1418c673 fixed variable store 2022-12-01 00:34:34 +01:00
.vscode added shunting yard expr parser 2022-10-03 14:11:49 +02:00
src fixed variable store 2022-12-01 00:34:34 +01:00
.gitignore added tokenizer 2022-09-21 23:32:09 +02:00
Cargo.lock proper error message added 2022-10-12 09:33:33 +02:00
Cargo.toml improved error message composition 2022-11-14 17:50:34 +01:00
README.md improved error message composition 2022-11-14 17:50:34 +01:00
test.erpn added operator typehinting 2022-11-30 19:07:46 +01:00

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:

  1. a COMEFROM keyword (inverse goto)
  2. a don't code block which never executes
  3. no if. only unless, an inverted version of if. Meaning a block gets executed if the expression is false
  4. three spaces start a single line comment
  5. many ways of making comments: // comment, :REM: comment, # comment, -- comment -- cuz we can

Keywords

SyntaxDescriptionExample
UnlessInverted if. Only executes the following block if the expression is false
unless 3 > 4 {
    // code block
}
LoopWhile(true)-Loop. Loops forever until either yield, ret, break are used.
Loop take no boolean expression.
loop {
    // code block
}
contShort form for “continue”. Jumps to the next iteration of a loop 
breakExits a loop immediately 
yieldReturns from a function with an argument as return value
foo() = int {
    yield 4
}
retShort 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. 
pleaseDecides on runtime wether a block should be executed or not.
please {
	// code
}

Example code

foo(bar: int, abc:int) = int {
    bar + abc
}

main {
    foo(4, 5)
}