28 lines
549 B
Rust
28 lines
549 B
Rust
use std::collections::HashMap;
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
pub enum Node {
|
|
Ident(String),
|
|
LitInt(u64),
|
|
Binary(String, Box<Node>, Box<Node>),
|
|
Parenthesized(Box<Node>),
|
|
}
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
pub enum Type {
|
|
Ident(String),
|
|
Arrow(Box<Type>, Box<Type>),
|
|
}
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
pub struct TypeDefinition {
|
|
pub name: String,
|
|
pub constructors: HashMap<String, TypeConstructor>,
|
|
}
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
pub enum TypeConstructor {
|
|
Record(HashMap<String, Box<Type>>),
|
|
Variant(Vec<Box<Type>>),
|
|
}
|