Crates.io | chandeliers-syn |
lib.rs | chandeliers-syn |
version | 1.0.0 |
source | src |
created_at | 2023-10-24 13:23:02.593625 |
updated_at | 2024-01-05 20:24:20.17311 |
description | Syntax of the Lustre language, to be parsed by procedural macros |
homepage | |
repository | https://github.com/Vanille-N/chandeliers |
max_upload_size | |
id | 1012368 |
size | 117,763 |
Syntax of Lustre.
In this crate we describe the parsing AST of Lustre programs. This AST is not meant to be used directly, instead it should be translated into one that is more convenient for static analysis.
All types of the module ast
implement syn::parse::Parse
, so they
can be parsed from any stream of tokens that conforms to the structure
expected by syn
.
The typical usage inside a proc macro would be like:
use chandeliers_syn::ast::Prog;
use proc_macro::TokenStream;
#[proc_macro]
pub fn get_and_handle_ast(input: TokenStream) -> TokenStream {
let prog: Prog = syn::parse_macro_input!(input as Prog);
// now you have a `Prog`, you can e.g.
// `Prog::translate` it to get something that can be used by
// Chandeliers' sanitizer.
}