UFL
Still in development, documentation not final.
Index
- The Syntax
- Defining Variables
- Defining Functions
- Calling Functions
- Logic
- Core Calls
The Syntax
When UFI parses a file, the file is separated into tokens which are then put into lines.
Lines end with the ";" character.
print "Hello World\n";
pause;
Defining Variables
To define a variable use the def token followed by the name of the variable and its value.
Example
def x 12;
def f 5.0;
def s "a string";
Defining Functions
To define a function use the func token followed by the name of the function you want to define.
Example
func test;
print "Hello World\n";
ret 0;
end;
Calling Functions
To call a function simply put the name of the function followed by its arguments.
Example
test;
You can send any data type or constant through an argument.
Example
def x 5;
test x "test";
Sends the value of x and the string "test".
You can also call a function in an argument.
Example
print (test);
print (test x "test");
Logic
The logic is the same as in any other language.
Example
def x 2;
def y x;
if x = y;
print "equal\n";
end;
Core Calls
There are various core calls which are integrated into the interpreter.
-
print [argument]
Prints the argument to screen.
-
pause
Pauses till the user presses enter.
-
readinput
Returns a string from user input.
Example
def buf (readinput);