Skip to content

Latest commit

 

History

History
85 lines (77 loc) · 3.6 KB

1.3.0.md

File metadata and controls

85 lines (77 loc) · 3.6 KB

OAT v1.3.0 Documentation

Changes

  • Added a lot more functions
  • Changed comments so that you have to space comments from the code

Variables

dec var_name var_value - auto declares a variable
sdec - declares a string, a must for concatenation
idec - declares an integer
cdec - declares a char
fdec - declares a float
ddec - declares a double
bdec - declares a boolean
mov a b - copies the value of a into b
def temp_var_name - creates a temp value so that functions that use two arguments can send to a variable, like pow
rdef used_var - moves an already initialized variable into DEF
conv 76 double - converts a into b and places it into DEF. Uses static_cast(x)
iconv a b - converts a into an inter and then stores it in b. works on strings
fconv a b - converts a into a float and then places it in b. works on strings
dconv a b - converts a into a double and then places it in b. works on strings

Math

cat a b - adds two strings together. converts b into a string
add a b - adds a and b and stores it in a
sub a b - subtracts b from a and stores it in a
mul a b - multiplies a and b and stores it in a
div a b - divides a and b and stores it in a
mod a b - gets the modulus of a and b and stores it in a
pow a b - gets the power of a and b and stores them in DEF or a custom def
rpow a b - recursive power. calculates a^b, then stores it back into a
ipow a b - same as before, but more accurate
fpow a b - more accurate powers for floats
dpow a b - more accurate powers for doubles
round a b - rounds a, and puts it into new variable b
defadd - adds a and b then stores it in DEF
defsub - subtracts b from a then stores it in DEF
defmul - multiplies a and b then stores it in DEF
defdiv - divides a and b then stores it in DEF
defmod - modulus of a and b is stored in DEF
defpow - gets a^b then stores it in DEF

Input/Output

io out a - prints out a to the console
io nlout a - prints out a to the console with a newline appended
io in name - declares name as a string, then gets the input and stores it in name
io defin - gets input, then stores it in DEF
io input message_var - displays the message in message_var, then stores input in DEF

Conditional statements

Assert

asserteq a b - prints a == b to console. e.g. true or false assertlt a b - asserts if a < b
assertgt a b - asserts if a > b
assertgteq a b - asserts if a >= b
assertlteq a b - asserts if a <= b

fasserteq a b - formatted print a == b to console. e.g. a == b = false fassertlt a b - format asserts if a < b
fassertgt a b - format asserts if a > b
fassertgteq a b - format asserts if a >= b
fassertlteq a b - format asserts if a <= b

Miscellaneous

cpp - anything after here is C++ code. e.g. cpp std::cout << “Hello World!\n”;
include - includes libraries that certain functions use, so that you just include these, then use C++ code.
Include libraries:

  • io - for std::cout, etc
  • string - for string operations
  • conv - for conversions
  • math - for pow(), etc
  • type - for checking the type

Special Characters

Predefined variables

NEWLINE - \n - The newline character
SPACE - “ “ - a space
TRUE - true
FALSE - false

Comments

Comments start with a semicolon: “;”. Anything after the “;” will be ignored.
After v1.2.0, you can now add comments after code.
After v1.3.0 comments must be have at least 1 space after code.

Miscellaneous

Example Programs