grift_macros 0.1.1

Procedural macros for grift_parser standard library
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 12.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 271.28 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gold-silver-copper

Procedural macros for grift_parser standard library

This crate provides the include_stdlib! macro which parses a .scm file containing function definitions and transforms them into the format expected by the define_stdlib! macro.

Example

Given a file stdlib.scm:

;;; (map f lst) - Apply f to each element of lst
(define (map f lst) (if (null? lst) '() (cons (f (car lst)) (map f (cdr lst)))))

The macro:

include_stdlib!("stdlib.scm");

Expands to:

define_stdlib! {
    /// (map f lst) - Apply f to each element of lst
    Map("map", ["f", "lst"], "(if (null? lst) '() (cons (f (car lst)) (map f (cdr lst))))"),
}