// Pair ::= "(" val "," val ")" void Pair(Relation r) { if (ts.Current.kind != Kind.LEFT_PARENT) return; Expect(Kind.LEFT_PARENT); string x = ts.Current.value; Expect(Kind.VALUE); Expect(Kind.COMMA); string y = ts.Current.value; Expect(Kind.VALUE); Expect(Kind.RIGHT_PARENT); r.AddPair(x, y); }
// Cons ::= pair seqCons | ε void Cons(Relation r) { Pair(r); SeqCons(r); }
// SeqCons ::= "," pair seqCons | ε void SeqCons(Relation r) { if (ts.Current.kind != Kind.COMMA) return; ts.MoveNext(); Pair(r); SeqCons(r); }
public DSL() { statements = new Statements(); satisfy = new Relation(); notSatisfy = new Relation(); }