_____________________________________________________________________________
Immediately
+ - simplify metagrammar => go to top-down rewriting => finalize metagrammar and rdp-op's
+
- What is our use model?
- Parse, attribute, unify (ag)
- Parse, transform tree, walk (rdp)
this.synthetic = synthetic;
}
+ public static Union epsilon = new Union("()");
+ static { epsilon.add(Sequence.empty); }
+
private Forest.Ref epsilonForm = null;
Forest epsilonForm() {
if (epsilonForm != null) return epsilonForm;
/** returns an element which exactly matches the string given */
public static Element string(String s) {
- if (s.length() == 0) return MetaGrammar.epsilon;
+ if (s.length() == 0) return Union.epsilon;
final String escapified = "\""+StringUtil.escapify(s, "\"\r\n\\")+"\"";
Element ret;
if (s.length() == 1) {
private static final Union SELF = new Union("()");
- public static Union epsilon = new Union("()");
- static { epsilon.add(Sequence.empty); }
-
////////////////////////////////////////////////////////////////////////////////
private Union g;
public PreSequence _amp_(PreSequence p, Object[] o) { return p.and(new PreSequence(o, null).buildSequence(null, true, false, true)); }
public PreSequence _amp__tilde_(PreSequence p, Object[] o) { return p.not(new PreSequence(o, null).buildSequence(null, true, false, true)); }
public Object _star_(Element r) { return Repeat.many0(r); }
- public Element epsilon(Object o, Object b) { return epsilon; }
+ public Element epsilon(Object o, Object b) { return Union.epsilon; }
+ public Object _leftparen__rightparen_(Object o) { return Union.epsilon; }
public Element _rightparen_(Object e) { return SELF; }
public Element _bang_(Element r) { return r; }
public Object _caret_(String s) { return new MyLift(s); }
- public Object _leftparen__rightparen_(Object o) { return epsilon; }
public Union nonTerminal(String s) { return nonTerminal(s, null, false, false); }
public Union _colon__colon__equals_(String s, PreSequence[][] p) { return nonTerminal(s, p, false, false); }
public Union _bang__colon__colon__equals_(String s, PreSequence[][] p) { return nonTerminal(s, p, false, true); }
*
* This was written as an ad-hoc parser to facilitate
* experimentation with the TIB spec. Once the spec is finalized it
- * should probably be rewritten using a parser-generator, if
- * possible (it is unclear whether or not the associated grammar is
- * context-free).
+ * should probably be rewritten.
*/
public class Tib implements Token.Stream<CharToken> {
}
}
- public static class Block /*implements Token*/ {
+ public static class Block {
Block parent;
public final int row;
public final int col;
private final Vector children = new Vector();
private String pending = "";
- //public Location getLocation() { return /*new Location.Cartesian(row, col)*/null; }
public int size() { return children.size(); }
public Object child(int i) { return children.elementAt(i); }
public boolean isLiteral() { return false; }