initial parser implementation

This commit is contained in:
Michael Sippel 2023-10-02 01:28:22 +02:00
parent 8ec95dfbed
commit 8fa38ca7d3
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 348 additions and 3 deletions

View file

@ -54,6 +54,23 @@ impl TypeTerm {
self
}
pub fn repr_as(&mut self, t: impl Into<TypeTerm>) -> &mut Self {
match self {
TypeTerm::Ladder(rungs) => {
rungs.push(t.into());
}
_ => {
*self = TypeTerm::Ladder(vec![
self.clone(),
t.into()
])
}
}
self
}
pub fn num_arg(&mut self, v: i64) -> &mut Self {
self.arg(TypeTerm::Num(v))
}