#macro #language #methods #compiler

nightly macro lead_lang_macros

Interpreter of the Lead Programming Language

143 releases (20 stable)

new 2025.5.0 May 1, 2025
2025.4.26-nightly… Apr 26, 2025
2025.3.25-nightly… Mar 25, 2025
2025.2.9 Feb 9, 2025
2024.11.28 Nov 28, 2024

#688 in Procedural macros

Download history 947/week @ 2025-01-29 740/week @ 2025-02-05 238/week @ 2025-02-12 2649/week @ 2025-02-26 2506/week @ 2025-03-05 729/week @ 2025-03-12 2550/week @ 2025-03-19 284/week @ 2025-03-26 558/week @ 2025-04-02 10/week @ 2025-04-09 3/week @ 2025-04-16 349/week @ 2025-04-23

1,054 downloads per month

MIT license

170KB
4.5K SLoC

A few rules:
  • The variables are only valid till the function execution.
  • Storage of LeadLang variable data (except the moved ones) requires cloning.
  • You shouldn't store the mutable or immutable reference of a variable.

Got to define function

Simple LeadLang Package

use interpreter::{generate, module, pkg_name};
use lead_lang_macros::{define, methods};

use interpreter::BufValue;

module! {
  Module1,
  pkg_name! { "Module" },
  methods! {
    foo
  }
}

generate! {
  Module1
}

#[define((
  desc: "Prints a variable",
  notes: Some("Optional Note"),
  params: [
   // "my-custom-regex, see example below",
   r"\$[a-z0-9_]*" // This is a regex of a lead variable
  ],
  returns: Some("%null"), // %null means that it returns nothing
  usage: [
   (
    desc: "Prints $hello",
    code: "print $hello"
   )
  ]
  root: Some("MyNewRT"), // This is a method on a RuntimeValue
))]
fn foo(var: &BufValue) {
  println!("{}", var.display());
}

Dependencies

~5–27MB
~376K SLoC