Welcome to Raaawr! Language Documentation
Raaawr! is a primal, yet powerful, programming language designed for the modern dinosaur. It's simple, expressive, and full of roars and stomps!
Navigate through the sections on the left to learn about Raaawr!'s syntax, commands, and features.
Program Structure
Every Raaawr! program **must** begin with a mighty GRRRRRRR!
and end with a satisfied
HSSSSSSS!
. **Forgetting these will cause the Raptor to be confused and your code will not run!** Anything outside these boundaries will be ignored by the Raptor.
GRRRRRRR!
Marks the beginning of your Raaawr! program.
GRRRRRRR!
// Your Raaawr! code goes here
HSSSSSSS!
HSSSSSSS!
Marks the end of your Raaawr! program.
GRRRRRRR!
// Your Raaawr! code goes here
HSSSSSSS!
Variables
Variables in Raaawr! are used to store values, like the number of prey or the name of a hunter. They must start with an uppercase or lowercase letter or an underscore.
RAAAWR! (Declare Variable)
Use RAAAWR!
to declare a new variable and assign an initial value to it. **Variables must be declared with RAAAWR!
before they can be used or assigned new values.**
RAAAWR! MY_PREY_COUNT RAAWR 10
RAAAWR! hunter_name RAAWR "Rex"
RAAAWR. (Assign Value)
Use RAAAWR.
to assign a new value to an already declared variable.
RAAAWR! MY_PREY_COUNT RAAWR 10
RAAAWR. MY_PREY_COUNT RAAWR 15
Functions (Territories)
Functions, or "Territories" in Raaawr!, allow you to group reusable blocks of code. They can accept parameters and return values.
DEFINE_TERRITORY
Defines a new function. Parameters are listed in parentheses, separated by RAAWR_KEYWORD
.
DEFINE_TERRITORY HUNT_SUCCESS (PREY_CAUGHT RAAWR_KEYWORD HUNTER)
ROAR HUNTER ROOOOAAR " caught " ROOOOAAR PREY_CAUGHT ROOOOAAR " prey!"
END_TERRITORY
END_TERRITORY
Marks the end of a function definition.
DEFINE_TERRITORY MY_FUNCTION ()
// Function body
END_TERRITORY
RETURN_PREY
Returns a value from a function. This should be the last statement executed in a territory if a value is expected.
DEFINE_TERRITORY GET_BEST_PREY ()
RETURN_PREY "Mammoth"
END_TERRITORY
CALL_TERRITORY
Calls a defined function. Arguments are passed in parentheses, separated by RAAWR_KEYWORD
.
RAAAWR! RESULT RAAWR CALL_TERRITORY GET_BEST_PREY ()
CALL_TERRITORY HUNT_SUCCESS (5 RAAWR_KEYWORD "T-Rex")
Control Flow
Control the flow of your Raaawr! program with conditional statements and loops.
IF_ROAR
Starts a conditional block. Executes code if the condition is true. Conditions must be enclosed in parentheses.
IF_ROAR (IS_HUNGRY RAAWR== GRRR) THEN_CHOMP
ROAR "Time to hunt!"
END_HUNT
THEN_CHOMP
Marks the start of the code block to execute if the IF_ROAR
condition is true.
IF_ROAR (IS_HUNGRY RAAWR== GRRR) THEN_CHOMP
ROAR "Time to hunt!"
END_HUNT
ELSE_STOMP
Optional. Marks the start of the code block to execute if the IF_ROAR
condition is false.
IF_ROAR (IS_HUNGRY RAAWR== GRRR) THEN_CHOMP
ROAR "Time to hunt!"
ELSE_STOMP
ROAR "Still full from last meal."
END_HUNT
END_HUNT
Marks the end of an IF_ROAR
conditional block.
IF_ROAR (IS_HUNGRY RAAWR== GRRR) THEN_CHOMP
// ...
END_HUNT
WHILE_ROAR
Starts a loop that continues as long as a condition is true. Conditions must be enclosed in parentheses.
WHILE_ROAR (HAS_PREY RAAWR== GRRR) KEEP_MIGRATING
ROAR "Still migrating..."
END_MIGRATION
KEEP_MIGRATING
Marks the start of the code block to execute repeatedly in a WHILE_ROAR
loop.
WHILE_ROAR (HAS_PREY RAAWR== GRRR) KEEP_MIGRATING
ROAR "Still migrating..."
END_MIGRATION
END_MIGRATION
Marks the end of a WHILE_ROAR
loop.
WHILE_ROAR (HAS_PREY RAAWR== GRRR) KEEP_MIGRATING
// ...
END_MIGRATION
Operators
Raaawr! supports various operators for arithmetic, comparison, and string concatenation. Expressions must
be flat and binary (e.g., A RAAWR+ B
).
Arithmetic Operators
RAAWR+
: AdditionRAAWR-
: SubtractionRAAWR*
: MultiplicationRAAWR/
: DivisionRAAWR%
: Modulo
RAAAWR! RESULT RAAWR (10 RAAWR+ 5)
RAAAWR! REMAINDER RAAWR (17 RAAWR% 3)
Comparison Operators
RAAWR==
: EqualsRAAWR>
: Greater thanRAAWR<
: Less than
IF_ROAR (AGE RAAWR> 18) THEN_CHOMP
ROAR "Adult dinosaur!"
END_HUNT
Concatenation Operator
ROOOOAAR
: Concatenates strings, numbers, or booleans.
RAAAWR! GREETING RAAWR "Hello " ROOOOAAR "World!"
ROAR "The answer is: " ROOOOAAR (10 RAAWR+ 5)
Literals
Fixed values used directly in your code.
Booleans (GRRR, HISS)
GRRR
: Represents true.HISS
: Represents false.
RAAAWR! IS_HUNGRY RAAWR GRRR
RAAAWR! IS_SLEEPY RAAWR HISS
Numbers
Integer or decimal numbers.
RAAAWR! COUNT RAAWR 42
RAAAWR! TEMPERATURE RAAWR 98.6
Strings
Text enclosed in double quotes.
RAAAWR! MESSAGE RAAWR "Beware of the volcano!"
Input/Output
Interact with the outside world using these commands.
ROAR (Output)
Prints a value to the output. Similar to console.log
.
ROAR "Hello, fellow dinosaur!"
ROAR MY_PREY_COUNT
SNIFF (Input)
Reads input from the user and assigns it to a variable. **Remember to declare the variable with RAAAWR!
before using SNIFF
to assign a value to it.**
RAAAWR! FAVORITE_DINOSAUR RAAWR "" // Declare the variable first
ROAR "What is your favorite dinosaur?"
SNIFF FAVORITE_DINOSAUR
ROAR "You like " ROOOOAAR FAVORITE_DINOSAUR ROOOOAAR "! A fine choice."