Skip to main content

Examples Catalog

All examples live in the repository under examples/.

Run any example with:

raml examples/Language/01_basics.rml

Language Examples​

  • examples/Language/01_basics.rml Variables, arithmetic, conditionals, loops, and ternary.
  • examples/Language/02_structs_methods.rml Objects, methods, and standalone functions.
  • examples/Language/03_memory_pointers.rml Heap allocation, pointers, address operations, and free.
  • examples/Language/04_nested_structs.rml Nested objects and field access.
  • examples/Language/05_flow_errors_jump.rml Labels, jump, try/catch/end, and switch.
  • examples/Language/06_bitstreams_io.rml Bitstreams with keyboard, save, and load.
  • examples/Language/07_example.rml Bit operations, lengths, and shifts.

App Examples​

Calculator​

examples/Apps/calculator.rml - Simple interactive CLI calculator demonstrating:

  • Arithmetic operations with bit-precise types
  • Interactive input/output with keyboard and print
  • Control flow with if/orif/else

Tic-Tac-Toe​

examples/Apps/tictactoe.rml - Two-player tic-tac-toe in the terminal demonstrating:

  • Objects with fields and methods (board with get, set, full, winner, print)
  • Method calls with arguments: ->b:get move, ->b:set move player
  • Bitstream input handling: move = keyboard returns bs_t
  • Automatic type conversion when passing bitstreams as numeric arguments
  • Complex control flow with while, if, break, continue
  • Object initialization with make

Inventory System​

examples/Apps/inventory_system.rml - Warehouse inventory management demonstrating:

  • Objects with multiple fields and methods (inline + block + external definitions)
  • Nested method calls and function return values
  • switchloop with continue for looping switch behavior
  • File I/O with save and load
  • Error handling with try/catch/end
  • Pointer operations, compound assignments, and pre/post increment
  • Bitwise operators, shift operations, and address equality (=#=)
  • Double-colon boolean grouping (::expr::)