streamline code generation with iterators and traits

This commit is contained in:
Mark Thom
2017-01-22 11:24:29 -07:00
parent 9be3445517
commit ed2343be9f
10 changed files with 339 additions and 244 deletions

View File

@@ -1,3 +1,4 @@
use std::cell::{Cell};
use l0::ast::{Atom, Term, TopLevel, Var};
grammar;
@@ -23,8 +24,8 @@ Term : Term = {
<a:Atom> "(" <ts: (<BoxedTerm> ",")*> <t:BoxedTerm> ")" => {
let mut ts = ts;
ts.push(t);
Term::Clause(a, ts)
Term::Clause(Cell::new(0), a, ts)
},
<Atom> => Term::Atom(<>),
<Var> => Term::Var(<>),
<Atom> => Term::Atom(Cell::new(0), <>),
<Var> => Term::Var(Cell::new(0), <>),
};