From: adam Date: Wed, 14 Dec 2005 05:07:48 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~566 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=558f61d337215d3f65d503e1dc97300289efa5c4;hp=4160ca39d91856b7baf89014cae80ef91a67dc45 checkpoint darcs-hash:20051214050748-5007d-ae31b182e3df97c8606513d184a990a90f67b16d.gz --- diff --git a/TODO b/TODO index 1185209..972a801 100644 --- a/TODO +++ b/TODO @@ -1,34 +1,3 @@ -// priorities are all messy and dont get serialized -// 1. Error messages -// 2. Java MetaGrammar (proof of concept) -// 3. Ivan's MetaGrammar -// 4. Documentation format -// - TIB - -// TODO: better API for interfacing with Java -// TODO: error messages -// TODO: integrate with TIB - -// Element -// Walk -// ParseTable / GSS -// MetaGrammar (necessary/relevant?) -// Tree (cleanup?) -// Union.SubUnion -// Repeat - -// FEATURE: serialization of ParseTable's, generation of Java code -// FEATURE: infer reject elements for literals -// FEATURE: prefer whitespace higher up -// FEATURE: full conjunctive and boolean grammars -// FEATURE: "ambiguity modulo dropped fragments"? can this be checked for statically? eliminated statically? -// - drop stuff during the parsing process (drop nodes) - -// LATER: Element -- parameterize over the input token type? Makes a huge mess... -// LATER: Go back to where Sequence is not an Element? -// - The original motivation for making Sequence "first class" was the fact that -// in order to do associativity right you need to have per-Sequence follow sets - ______________________________________________________________________________ Immediately @@ -63,6 +32,13 @@ Soon - "Regular Right Part" grammars (NP Chapman, etc) - Attribute unification + - serialization of parse tables + - inference of rejections for literals + - "prefer whitespace higher up" (?) + - "ambiguity modulo dropped fragments"? + - can this be checked statically? + - eliminated statically? + ______________________________________________________________________________ Later diff --git a/src/edu/berkeley/sbp/misc/MetaGrammar.java b/src/edu/berkeley/sbp/misc/MetaGrammar.java index f408275..0b70878 100644 --- a/src/edu/berkeley/sbp/misc/MetaGrammar.java +++ b/src/edu/berkeley/sbp/misc/MetaGrammar.java @@ -94,14 +94,15 @@ public class MetaGrammar extends ReflectiveWalker { public MetaGrammar grammar(Object o, Union[] u, Object x) { return this; } public char _backslash_n() { return '\n'; } public char _backslash_r() { return '\r'; } - public String literal(String s) { return s; } - /* - public Element literal(String s) { + //public String literal(String s) { return s; } + + public Object literal(String s) { Element e = CharToken.string(s); - dropAll.add(e); - return e; + return new MyDrop(e); + //dropAll.add(e); + //return e; } - */ + public Range range0(char a) { return new Range(a, a); } public Range range0(char a, char b) { return new Range(a, b); } public Range range1(char a, char b) { return new Range(a, b); } @@ -367,6 +368,7 @@ public class MetaGrammar extends ReflectiveWalker { + // DO NOT EDIT STUFF BELOW: IT IS AUTOMATICALLY GENERATED new Tree(null, "gram", new Tree[] { new Tree(null, null, new Tree[] { }), new Tree(null, "grammar", new Tree[] { new Tree(null, null, new Tree[] { new Tree(null, "::=", new Tree[] { new Tree(null, "sify", new Tree[] { new Tree(null, null, new Tree[] { new Tree(null, "s", new Tree[] { })})}), @@ -953,3 +955,4 @@ new Tree(null, "gram", new Tree[] { new Tree(null, null, new Tree[] { }), +