Crate basic_dsl

Crate basic_dsl 

Source
Expand description

§BASIC DSL

A procedural macro crate that provides a BASIC interpreter DSL embedded in Rust.

§Usage

use basic_dsl::basic;

basic!(r#"
    10 LET X = 1
    20 PRINT X
    30 IF X < 5 THEN GOTO 50
    40 END
    50 LET X = X + 1
    60 GOTO 20
"#);

The macro supports:

  • Variable assignment with LET
  • Printing with PRINT (numbers and string literals)
  • Conditional jumps with IF...THEN GOTO
  • Unconditional jumps with GOTO
  • Line labels and program termination with END

Macros§

basic
Main entry point for the BASIC DSL macro.