Tutorials
Each tutorial is a small, runnable program from the examples/ directory.
Running Modes
Interpreted Mode
Run directly with the raml interpreter:
raml path/to/file.rml
Compiled Mode
Compile directly to an executable:
# Output defaults to the input filename (without .rml)
ramlc compile path/to/file.rml
# Or specify output path
ramlc compile path/to/file.rml -o /tmp/my_program
./my_program
To only generate C files (for custom gcc flags or cross-compilation):
ramlc compile path/to/file.rml -o /tmp/c_output --c-only
The interpreter is best for quick iteration and debugging. Use compiled mode for performance or to produce standalone binaries.
1. Basics: Variables, Math, and Loops
- File:
examples/Language/01_basics.rml - Goal: Learn declarations, arithmetic, conditionals, and loops.
- Try: Add a second loop and experiment with
bsbitstream types.
2. Objects and Methods
- File:
examples/Language/02_structs_methods.rml - Goal: Define objects, methods, and standalone functions.
- Try: Add a new method that returns a computed value.
3. Memory and Pointers
- File:
examples/Language/03_memory_pointers.rml - Goal: Allocate objects, use pointers, and free memory.
- Try: Add another node and compare pointer addresses with
=#=.
4. Nested Objects
- File:
examples/Language/04_nested_structs.rml - Goal: Work with nested objects and field access.
- Try: Add a new nested field and include it in the
summethod.
5. Control Flow and Errors
- File:
examples/Language/05_flow_errors_jump.rml - Goal: Use labels,
jump,try/catch/end, andswitchblocks. - Try: Add another
switchcase and experiment withswitchloop.
6. Bitstreams and IO
- File:
examples/Language/06_bitstreams_io.rml - Goal: Read input, save a bitstream, and load it back.
- Try: Save to a different filename and verify the loaded data.
7. CLI Calculator (App)
- File:
examples/Apps/calculator.rml - Goal: Build a simple interactive program using loops and input.
- Try: Add a new operation like modulo.
8. Tic-Tac-Toe (App)
- File:
examples/Apps/tictactoe.rml - Goal: Combine objects, methods, and control flow into a larger app.
- Try: Add input validation messages or a replay option.