*** contains spoilers (I think), sorry :(
YEAGER Syntax Overview:
- Variables: var name = value; (global and local variables are enforced according to scopes) e.g: var x = 5; { var x = 10; print x; (10); } print x; (5); - Print: print expression; e.g: print x + 3; - Arithmetic: +, -, *, / (follows PAMDAS order of operations) e.g: 2 + 3 * 4 / 5 - 1; - Comments: // single-line comment - Functions: fun Name() {} e.g: fun Transform() { print "Titan form activated!"; } - Blocks: { } (scopes enforced, variables defined in scopes are captured in closures) - Classes: class Name {} e.g: class Breakfast {} - Class Inheritance: class Name < SuperclassName {} - Methods: defined inside of classes, same as functions e.g: class Breakfast { cook() { print "Cook the morning."; } } - Init method: if defined, will run automatically every time a new instance is created. e.g: class Breakfast { init(name) { this.name = name; } } - Instances: ClassName() e.g: var eggs = Breakfast(); - Setters and getters: (only on instances) Instance.fieldName or Instance.methodName e.g: eggs.recipe = "Three step instructions"; or eggs.cook(); - Conditionals: while, if, for, and, or ( e.g: if (angry) { transform(); } else { chill(); } while (angry) { yellReallyLoud(); } var a = 10; for (var i = 1; i < a; i = i + 1) { print i; } var a = 1; print(a < 5 and a > 0); << TRUE print(a == 0 or a > 2) << FALSE )
More features coming soon!