AkaiLang/syntax.akai

62 lines
871 B
Text

class Position:
// Properties
var int: x
var int: y
// Constructor
Position(_x, _y) {
x = _x
y = _y
}
// Inheritance
class Cat derive Animal:
/*
code goes here
*/
fun helloWorld() {
// Variables either dynamically or statically typed
// -> Type inference
var String: test = "I'm a string"
var foo = 12 // reads as int
var bar = foo + 10
print("Hello World " + bar)
}
fun returnsIntegerPlusOne(int: i): int {
-> i + 1
}
/*
Keywords/ Tokens:
- class
- interface
- fun
- var
- derive // Inheritance for classes
- impl // for interfaces
// Standard keywords for basic stuff
- int
- float
- char
- bool
- if
- else
- enum
- (
- )
- {
- }
- :
- +
- -
- /
- *
- =
*/