Crate carmen_lang

Crate carmen_lang 

Source
Expand description

§Carmen - Programmatic Music Composition Language

Carmen is a novel, programmatic language designed for music composition. This library provides the core functionality to parse, interpret, and execute Carmen source code, as well as export compositions to various formats.

§Features

  • Lexical Analysis: Tokenize Carmen source code into a stream of tokens
  • Parsing: Parse tokens into an Abstract Syntax Tree (AST)
  • Interpretation: Execute Carmen programs and evaluate musical expressions
  • Export: Convert compositions to formats like LilyPond for sheet music generation

Modules§

ast
Abstract Syntax Tree (AST) definitions.
cli
Command-line interface.
common
Common utilities and data structures.
core
Core music theory types and functionality.
errors
Error handling module.
exporter
Score export functionality for converting Carmen files to various formats.
interpreter
Carmen language interpreter.
lexer
Lexical analysis.
parser
Parser for the Carmen language.
repl
Carmen REPL Module

Macros§

extract_args
Extracts exactly $count arguments of type $type from an argument list.
extract_three
Extracts exactly three arguments and returns them as a tuple. This is useful for ternary operations.
extract_two
Extracts exactly two arguments and returns them as a tuple. This is a common pattern for binary operations.

Functions§

parse
Parses Carmen source code into an Abstract Syntax Tree (AST).
run
Executes Carmen source code and returns the resulting value.
run_with_interpreter
Executes Carmen source code using an existing interpreter instance.
tokenize
Tokenizes Carmen source code into a vector of tokens.