[e-cvs] cvs commit: e/src/jsrc/org/quasiliteral/term Term.java TermBuilder.java TermParser.java term.y

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Wed, 12 Dec 2001 01:36:00 -0500


markm       01/12/12 01:36:00

  Modified:    src      Makefile
               src/csrc/setup eprops-template.txt
               src/esrc/scripts setup.e
               src/jsrc/org/capml/dom Element.java Text.java
               src/jsrc/org/erights/e/develop/exception ExceptionMgr.java
               src/jsrc/org/erights/e/elang/evm AssignExpr.java
                        CallExpr.java NounPattern.java
               src/jsrc/org/erights/e/elang/interp Help.java
                        InteractiveInterp.java ScopeSetup.java
               src/jsrc/org/erights/e/elang/scope InnerScope.java
                        OuterScope.java Scope.java
               src/jsrc/org/erights/e/elib/base ClassDesc.java
               src/jsrc/org/erights/e/elib/eio UnQuote.java
               src/jsrc/org/erights/e/elib/tables ConstList.java EMap.java
                        FlexListImpl.java ScalarColumn.java
               src/jsrc/org/erights/e/meta/java/lang ArrayGuardSugar.java
               src/jsrc/org/quasiliteral/astro ASTBuilder.java Astro.java
                        AstroAST.java AstroArg.java AstroBuilder.java
                        AstroToken.java BaseBuilder.java
               src/jsrc/org/quasiliteral/quasiterm QuasiBuilder.java
                        QuasiBuilderAdaptor.java
               src/jsrc/org/quasiliteral/term Term.java TermBuilder.java
                        TermParser.java term.y
  Added:       src/jsrc/org/erights/e/elang/scope meta-scope.updoc
  Log:
  For the 0.8.10delta1 release.  Scopes print usefully

Revision  Changes    Path
1.126     +2 -2      e/src/Makefile

Index: Makefile
===================================================================
RCS file: /cvs/e/src/Makefile,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- Makefile	2001/11/27 07:27:53	1.125
+++ Makefile	2001/12/12 06:35:57	1.126
@@ -7,8 +7,8 @@
 
 # Prefix tagging this release's attributes
 PREFIX=E
-DOTVER=0.8.10gamma4
-TAGVER=0_8_10gamma4
+DOTVER=0.8.10delta1
+TAGVER=0_8_10delta1
 RELEASE=working
 
 TOP=..



1.25      +14 -8     e/src/csrc/setup/eprops-template.txt

Index: eprops-template.txt
===================================================================
RCS file: /cvs/e/src/csrc/setup/eprops-template.txt,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- eprops-template.txt	2001/12/02 05:32:05	1.24
+++ eprops-template.txt	2001/12/12 06:35:57	1.25
@@ -211,6 +211,16 @@
 
 e.swingLnF=${{e.swingLnF}}
 
+# Currently does nothing.
+#
+# A placeholder for the new safej API taming.  For classes for which
+# there are no corresponding taming files, this switch says how they
+# should be made available to E.  If "true", then these classes will
+# be importable as "<unsafe:...>".  If "false", then untamed classes
+# will not be available at all.  Defaults to "false".
+
+e.safej.allow-untamed-classes=${{e.safej.allow-untamed-classes}}
+
 
 # When set to false (the default) or if absent, then the interpreter
 # acts as an interactive interpreter when it's not reading from a
@@ -355,14 +365,10 @@
 
 
 # Accepts the experimental "meta scope()" expression, which reifies
-# the current lexical scope into a Scope object.  The proposed
-# semantics of this construct only has the scope within an object
-# include those variables defined outside the object that are used
-# freely within the object -- the instance variables.  The current
-# implementation is therefore buggy, since it shows that the current
-# implementation incorrectly captures the entire environment.  This
-# feature will remain experimental at least until this bug is fixed,
-# which probably awaits the scope analysis needed for compilation.
+# the current lexical scope into a Scope object.  The semantics of
+# this construct only has the scope within an object include those
+# variables defined outside the object that are used freely within the
+# object -- the instance variables.
 
 e.enable.meta-scope=${{e.enable.meta-scope}}
 



1.21      +25 -23    e/src/esrc/scripts/setup.e

Index: setup.e
===================================================================
RCS file: /cvs/e/src/esrc/scripts/setup.e,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- setup.e	2001/12/02 05:32:05	1.20
+++ setup.e	2001/12/12 06:35:57	1.21
@@ -13,30 +13,32 @@
     "e.vendor"                   => "ERights.org",
     "e.vendor.url"               => "http://www.erights.org/",
     "e.vendor.url.bug"           => "mailto:bugs@erights.org",
-    "e.onErrorExit"              => "gui",
-    "e.swingLnF"                 => "platform",
-    "e.interp.interactive"       => "false",
-    "e.interp.parseSpam"         => "false",
-    "e.interp.expand"            => "false",
-    "e.interp.show-transformed"  => "false",
-    "e.interp.verbose"           => "false",
-    "e.interp.runner"            => "fe",
-    "e.interp.print-timing"      => "false",
 
-    "e.enable.anon-lambda"       => "allow",
-    "e.enable.auditors"          => "allow",
-    "e.enable.define"            => "allow",
-    "e.enable.dot-props"         => "allow",
-    "e.enable.meta-object"       => "false",
-    "e.enable.meta-scope"        => "false",
-    "e.enable.no-paren-call"     => "allow",
-    "e.enable.no-paren-method"   => "allow",
-    "e.enable.one-method-object" => "allow",
-    "e.enable.plumbing"          => "allow",
-    "e.enable.typedef"           => "allow",
-    "e.enable.when-clauses"      => "allow",
-    "e.enable.notabs"            => "allow",
-    "e.enable.lambda-args"       => "allow"
+    "e.onErrorExit"                     => "gui",
+    "e.swingLnF"                        => "platform",
+    "e.safej.allow-untamed-classes"     => "false",
+    "e.interp.interactive"              => "false",
+    "e.interp.parseSpam"                => "false",
+    "e.interp.expand"                   => "false",
+    "e.interp.show-transformed"         => "false",
+    "e.interp.verbose"                  => "false",
+    "e.interp.runner"                   => "fe",
+    "e.interp.print-timing"             => "false",
+
+    "e.enable.anon-lambda"              => "allow",
+    "e.enable.auditors"                 => "allow",
+    "e.enable.define"                   => "allow",
+    "e.enable.dot-props"                => "allow",
+    "e.enable.meta-object"              => "false",
+    "e.enable.meta-scope"               => "allow",
+    "e.enable.no-paren-call"            => "allow",
+    "e.enable.no-paren-method"          => "allow",
+    "e.enable.one-method-object"        => "allow",
+    "e.enable.plumbing"                 => "allow",
+    "e.enable.typedef"                  => "allow",
+    "e.enable.when-clauses"             => "allow",
+    "e.enable.notabs"                   => "allow",
+    "e.enable.lambda-args"              => "allow"
 ] diverge()
 
 # 'false' means overwrite rather than complain



1.10      +3 -3      e/src/jsrc/org/capml/dom/Element.java

Index: Element.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/dom/Element.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Element.java	2001/12/10 20:30:08	1.9
+++ Element.java	2001/12/12 06:35:57	1.10
@@ -156,12 +156,12 @@
     public Astro build(AstroBuilder builder) {
         AstroTag tag = builder.getSchema().obtainTagForName(myTagName);
         Astro func = builder.leafTag(tag, EmptyTwine.THE_ONE);
-        Object args = builder.argList();
+        Object args = builder.list();
         int len = myChildren.size();
         for (int i = 0; i < len; i++) {
             Node child = (Node)myChildren.get(i);
-            args = builder.argList(args, builder.arg(child.build(builder)));
+            args = builder.with(args, child.build(builder));
         }
-        return builder.node(func, args);
+        return builder.term(func, args);
     }
 }



1.10      +2 -2      e/src/jsrc/org/capml/dom/Text.java

Index: Text.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/dom/Text.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Text.java	2001/12/10 20:30:08	1.9
+++ Text.java	2001/12/12 06:35:57	1.10
@@ -155,8 +155,8 @@
      * text (as a leaf) and zero arguments.
      */
     public Astro build(AstroBuilder builder) {
-        return builder.node(builder.leafString(myData, EmptyTwine.THE_ONE),
-                            builder.argList());
+        return builder.term(builder.leafString(myData, EmptyTwine.THE_ONE),
+                            builder.list());
     }
 }
 



1.9       +1 -1      e/src/jsrc/org/erights/e/develop/exception/ExceptionMgr.java

Index: ExceptionMgr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/develop/exception/ExceptionMgr.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ExceptionMgr.java	2001/11/10 19:40:38	1.8
+++ ExceptionMgr.java	2001/12/12 06:35:57	1.9
@@ -48,7 +48,7 @@
         if (th instanceof RuntimeException) {
             return (RuntimeException)th;
         }
-        throw new NestedException("", th);
+        return new NestedException("", th);
     }
 
     /**



1.33      +5 -8      e/src/jsrc/org/erights/e/elang/evm/AssignExpr.java

Index: AssignExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/AssignExpr.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- AssignExpr.java	2001/12/10 20:30:08	1.32
+++ AssignExpr.java	2001/12/12 06:35:57	1.33
@@ -29,7 +29,6 @@
 import org.erights.e.elib.tables.FlexMap;
 import org.erights.e.elib.tables.Twine;
 import org.quasiliteral.astro.Astro;
-import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroTag;
 import org.quasiliteral.quasiterm.QuasiBuilder;
 
@@ -80,13 +79,11 @@
      */
     public Astro qbuild(QuasiBuilder qbuilder) {
         AstroTag tag = qbuilder.getSchema().getTagForCode(EParser.AssignExpr);
-        Astro functor = qbuilder.leafTag(tag,
-                                         Twine.fromString(":=", optSource()));
-        AstroArg noun = qbuilder.arg(myNoun.qbuild(qbuilder));
-        AstroArg rValue = qbuilder.arg(myRValue.qbuild(qbuilder));
-        return qbuilder.node(functor,
-                             qbuilder.argList(qbuilder.argList(noun),
-                                              rValue));
+        return qbuilder.term(qbuilder.leafTag(tag,
+                                              Twine.fromString(":=",
+                                                               optSource())),
+                             qbuilder.list(myNoun.qbuild(qbuilder),
+                                           myRValue.qbuild(qbuilder)));
     }
 
     /**



1.34      +0 -1      e/src/jsrc/org/erights/e/elang/evm/CallExpr.java

Index: CallExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/CallExpr.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- CallExpr.java	2001/12/10 20:30:08	1.33
+++ CallExpr.java	2001/12/12 06:35:57	1.34
@@ -28,7 +28,6 @@
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
 import org.quasiliteral.astro.Astro;
-import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.quasiterm.QuasiBuilder;
 
 import java.io.IOException;



1.7       +1 -7      e/src/jsrc/org/erights/e/elang/evm/NounPattern.java

Index: NounPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/NounPattern.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NounPattern.java	2001/12/02 06:01:42	1.6
+++ NounPattern.java	2001/12/12 06:35:57	1.7
@@ -57,12 +57,6 @@
  */
 public abstract class NounPattern extends Pattern {
 
-    /**
-     * A set of all the variable names that may not be shadowed (ie,
-     * redefined)
-     */
-    static public final ESet NonShadowable = ScopeSetup.nonShadowable();
-
     private String myVarName;
 
     /**
@@ -75,7 +69,7 @@
     protected NounPattern(String varName) {
         myVarName = varName;
         // NOTE non-shadowable variables seem like a bad idea....
-        if (NonShadowable.contains(myVarName)) {
+        if (ScopeSetup.NonShadowable.contains(myVarName)) {
             throw new RuntimeException("can't redefine " + myVarName);
         }
     }



1.20      +3 -2      e/src/jsrc/org/erights/e/elang/interp/Help.java

Index: Help.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/Help.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Help.java	2001/11/10 19:40:41	1.19
+++ Help.java	2001/12/12 06:35:57	1.20
@@ -50,8 +50,9 @@
      * therefore inadequate) heuristic.  But good enough for cheezy uses.
      * Note that this routine is not expected to internationalize well.
      */
-    static private String aan(String name) {
-        if (name.length() >= 1 && "aeiou".indexOf(name.charAt(0)) != -1) {
+    static public String aan(String name) {
+        char c = Character.toLowerCase(name.charAt(0));
+        if (name.length() >= 1 && "aeiouh".indexOf(c) != -1) {
             return "an " + name;
         } else {
             return "a " + name;



1.18      +7 -0      e/src/jsrc/org/erights/e/elang/interp/InteractiveInterp.java

Index: InteractiveInterp.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/InteractiveInterp.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- InteractiveInterp.java	2001/12/10 20:30:09	1.17
+++ InteractiveInterp.java	2001/12/12 06:35:57	1.18
@@ -495,6 +495,13 @@
       throws IOException, AlreadyDefinedException,
       UnsupportedLookAndFeelException, ClassNotFoundException,
       InstantiationException, IllegalAccessException {
+
+        //XXX retire this class and replace with evalServer
+        System.err.println
+          ("Command line errors may be unreported");
+        System.err.println
+          ("If possible, use Elmer instead until this bug is fixed");
+
         ConstList args = ConstList.fromArray(argArray);
         Properties sysProps = System.getProperties();
         TextWriter outs = new TextWriter(PrintStreamWriter.out(), true);



1.80      +9 -13     e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java

Index: ScopeSetup.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- ScopeSetup.java	2001/12/10 20:30:09	1.79
+++ ScopeSetup.java	2001/12/12 06:35:57	1.80
@@ -52,6 +52,7 @@
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.ConstSet;
 import org.erights.e.elib.util.ClassCache;
 import org.erights.e.meta.java.io.FileGetter;
 import org.quasiliteral.text.SimpleQuasiParser;
@@ -72,6 +73,13 @@
     static private final int OUTER_SPACE = 1000;
 
     /**
+     * Return the set of variable names defined in the universal scope that
+     * may not be shadowed (ie, redefined).
+     */
+    static public final ConstSet NonShadowable =
+      universalMaker().keys().snapshot();
+
+    /**
      * return null if not found
      */
     static private Class getClass(String fqName) {
@@ -83,17 +91,6 @@
     }
 
     /**
-     * Return the set of noun names defined in the universal scope that
-     * may not be shadowed. <p>
-     *
-     * NOTE: these could be cached, but they are actually only used to
-     *       set a variable in NounExpr, so the cache is currently unneeded.
-     */
-    static public ESet nonShadowable() {
-        return universalMaker().keys();
-    }
-
-    /**
      *
      * @author <a href="mailto:tribble@e-dean.com">E. Dean Tribble</a>
      */
@@ -186,8 +183,7 @@
                 "<import:org.erights.e.elang.syntax.epatt__quasiParser>");
         um.comp("sml__quasiParser", XMLQuasiParser.XMLQuasiParserMaker);
         um.comp("term__quasiParser", univ,
-                "<import:org.quasiliteral.quasiterm.QuasiTermBuilder>" +
-                " THE_ONE()");
+                "<import:org.quasiliteral.quasiterm.term__quasiParser>");
 
         um.init("universalScope", univ);             // not uconstant
         OuterScope realUniv = um.scope();



1.7       +13 -0     e/src/jsrc/org/erights/e/elang/scope/InnerScope.java

Index: InnerScope.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/scope/InnerScope.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InnerScope.java	2001/11/17 18:25:55	1.6
+++ InnerScope.java	2001/12/12 06:35:58	1.7
@@ -22,7 +22,10 @@
 import org.erights.e.elang.evm.NounExpr;
 import org.erights.e.elib.slot.Slot;
 import org.erights.e.elib.util.AlreadyDefinedException;
+import org.erights.e.elib.eio.TextWriter;
 
+import java.io.IOException;
+
 /**
  * A Scope that represents a nested lexical scope.
  * <p>
@@ -41,6 +44,16 @@
     public InnerScope(ScopeMap scopeMap, EvalContext ctx) {
         super(scopeMap);
         myEvalContext = ctx;
+    }
+
+    /**
+     *
+     */
+    public void printOn(TextWriter out) throws IOException {
+        out.print("an InnerScope");
+        TextWriter nest = out.indent();
+        nest.println();
+        printBindingsOn(false, nest);
     }
 
     public NounExpr reserveOuter(String name) {



1.8       +13 -0     e/src/jsrc/org/erights/e/elang/scope/OuterScope.java

Index: OuterScope.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/scope/OuterScope.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OuterScope.java	2001/12/02 06:01:44	1.7
+++ OuterScope.java	2001/12/12 06:35:58	1.8
@@ -24,7 +24,10 @@
 import org.erights.e.elib.slot.Slot;
 import org.erights.e.elib.tables.ConstMap;
 import org.erights.e.elib.util.AlreadyDefinedException;
+import org.erights.e.elib.eio.TextWriter;
 
+import java.io.IOException;
+
 /**
  * The normal implementation of an outermost E lexical scope.
  *
@@ -63,6 +66,16 @@
         myNextOuter = nextOuter;
         myIsMutable = isMutable;
     }
+    /**
+     *
+     */
+    public void printOn(TextWriter out) throws IOException {
+        out.print("an OuterScope");
+        TextWriter nest = out.indent();
+        nest.println();
+        printBindingsOn(false, nest);
+    }
+
 
     /*package*/
     Slot getCurrentAtIndex(int index) {



1.53      +47 -18    e/src/jsrc/org/erights/e/elang/scope/Scope.java

Index: Scope.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/scope/Scope.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- Scope.java	2001/11/17 18:25:55	1.52
+++ Scope.java	2001/12/12 06:35:58	1.53
@@ -22,13 +22,18 @@
 import org.erights.e.develop.format.StringHelper;
 import org.erights.e.elang.evm.ENode;
 import org.erights.e.elang.evm.NounExpr;
+import org.erights.e.elang.interp.Help;
+import org.erights.e.elang.interp.ScopeSetup;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.eio.UnQuote;
+import org.erights.e.elib.eio.EPrintable;
 import org.erights.e.elib.slot.FinalSlotMaker;
 import org.erights.e.elib.slot.Slot;
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.ConstMap;
+import org.erights.e.elib.tables.ConstSet;
 import org.erights.e.elib.util.AlreadyDefinedException;
+import org.erights.e.elib.base.ClassDesc;
 
 import java.io.IOException;
 import java.io.StringWriter;
@@ -42,7 +47,7 @@
  * @author <a href="mailto:tribble@e-dean.com">E. Dean Tribble</a>
  * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
  */
-public abstract class Scope {
+public abstract class Scope implements EPrintable {
 
     protected ScopeMap myScopeMap;
 
@@ -131,29 +136,53 @@
     }
 
     /**
-     * Returns a string showing the bindings in this scope in a
-     * pleasant, human readable format
+     * universalFlag defaults to true
      */
     public UnQuote bindings() throws IOException {
+        return bindings(true);
+    }
+
+    /**
+     * Returns a string showing the bindings in this scope in a
+     * pleasant, human readable format.
+     *
+     * @param universalFlag If set, then unshadowable names from the universal
+     *                      scope will be shown as well.
+     */
+    public UnQuote bindings(boolean universalFlag) throws IOException {
         StringWriter buf = new StringWriter();
-        final TextWriter os1 = new TextWriter(buf);
-        final TextWriter os2 = os1.indent();
-        Object names = myScopeMap.namesSet().getElements(String.class);
-        ConstList keys = ConstList.fromArray(names).sort();
-        for (int i = 0, len = keys.size(); i < len; i++) {
-            String key = (String)keys.get(i);
-            os1.print(key);
-            os2.lnPrint(get(key));
-            os1.println();
-        }
+        final TextWriter out = new TextWriter(buf);
+        printBindingsOn(universalFlag, out);
         return new UnQuote(StringHelper.canonical(buf.toString()));
     }
+
+    /**
+     *
+     */
+    /*package*/ void printBindingsOn(boolean universalFlag, TextWriter out)
+      throws IOException {
 
-    public String toString() {
-        try {
-            return bindings().toString();
-        } catch (IOException e) {
-            return "Could not print bindings";
+        ConstSet nameSet = myScopeMap.namesSet();
+        if (! universalFlag) {
+            nameSet = nameSet.butNot(ScopeSetup.NonShadowable);
+        }
+        String[] keys = (String[])nameSet.sort().getElements(String.class);
+        for (int i = 0, len = keys.length; i < len; i++) {
+            //we avoid another indented stream only by assuming only one line
+            //follows
+            out.print(keys[i], "\n    ");
+            try {
+                Object optValue = get(keys[i]);
+                if (null == optValue) {
+                    out.print("null");
+                } else {
+                    String sig = ClassDesc.typeSig(optValue.getClass());
+                    out.print(Help.aan(sig));
+                }
+            } catch (Exception ex) {
+                out.print("*** ", ex);
+            }
+            out.println();
         }
     }
 



1.1                  e/src/jsrc/org/erights/e/elang/scope/meta-scope.updoc

Index: meta-scope.updoc
===================================================================
    ? def m := meta scope()
    # syntax error: The optional e.enable.meta-scope feature in eprops.txt is currently off.
    #   def m := meta scope()
    #                       ^
    #
    
    ? pragma enable("meta-scope")
    ? 
    ? def m := meta scope()
    # value: an InnerScope
    #            CommandMaker
    #                an EImplByProxy
    #            JPanel__quasiParser
    #                an EImplByProxy
    #            awt__uriGetter
    #                a SwitchableRef
    #            cap__uriGetter
    #                an Introducer
    #            entropy
    #                an ESecureRandom
    #            fileURL__uriGetter
    #                an URLGetter
    #            file__uriGetter
    #                a StaticMaker
    #            ftp__uriGetter
    #                an URLGetter
    #            gopher__uriGetter
    #                an URLGetter
    #            http__uriGetter
    #                an URLGetter
    #            interp
    #                a SwitchableRef
    #            introducer
    #                an Introducer
    #            m
    #                an InnerScope
    #            news__uriGetter
    #                an URLGetter
    #            print
    #                an EImplByProxy
    #            println
    #                an EImplByProxy
    #            stderr
    #                a TextWriter
    #            stdout
    #                a TextWriter
    #            sturdyRef
    #                a Sturdifier
    #            swing__uriGetter
    #                a SwitchableRef
    #            tempTimer
    #                a Timer
    #            timer
    #                a Timer
    #            unsafe__uriGetter
    #                an UnsafeLoaderScope
    #            
    
    ? def func() :any {
    >     println("yup")
    >     meta scope()
    > }
    # value: <func>
    
    ? def scp := func()
    yup
    # value: an InnerScope
    #            println
    #                an EImplByProxy
    #            
    
    ? scp["println"]
    # value: <println>
    
    ? 




1.31      +1 -1      e/src/jsrc/org/erights/e/elib/base/ClassDesc.java

Index: ClassDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/base/ClassDesc.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ClassDesc.java	2001/12/02 06:01:45	1.30
+++ ClassDesc.java	2001/12/12 06:35:58	1.31
@@ -429,6 +429,6 @@
     public Object get() {
         //XXX this is a horrible way to do this, but I couldn't find any
         //simpler way.
-        return Array.newInstance(myClass, 0).getClass();
+        return get(0).getClass();
     }
 }



1.2       +8 -1      e/src/jsrc/org/erights/e/elib/eio/UnQuote.java

Index: UnQuote.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/eio/UnQuote.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnQuote.java	2001/09/07 05:49:22	1.1
+++ UnQuote.java	2001/12/12 06:35:58	1.2
@@ -8,7 +8,7 @@
  *
  * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
  */
-public class UnQuote {
+public class UnQuote implements EPrintable {
 
     private String myStr;
 
@@ -17,6 +17,13 @@
      */
     public UnQuote(String str) {
         myStr = str;
+    }
+
+    /**
+     *
+     */
+    public String toString() {
+        return myStr;
     }
 
     /**



1.21      +3 -0      e/src/jsrc/org/erights/e/elib/tables/ConstList.java

Index: ConstList.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ConstList.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ConstList.java	2001/12/02 06:01:47	1.20
+++ ConstList.java	2001/12/12 06:35:58	1.21
@@ -118,6 +118,9 @@
         //is it really this much trouble just to clone an array?
         Class valType = oldArray.getClass().getComponentType();
         int len = Array.getLength(oldArray);
+        //XXX The following is Array.newInstance(..) rather than
+        //EList.newArray(..) since arraycopy won't work between, for example,
+        //an int[23] and a Integer[23].  Bletch!
         Object result = Array.newInstance(valType, len);
         System.arraycopy(oldArray, 0, result, 0, len);
         return result;



1.33      +2 -2      e/src/jsrc/org/erights/e/elib/tables/EMap.java

Index: EMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/EMap.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- EMap.java	2001/12/02 06:01:47	1.32
+++ EMap.java	2001/12/12 06:35:58	1.33
@@ -411,8 +411,8 @@
                              Object oldKeys,
                              Object oldVals) {
         int len = permutation.length;
-        Object newKeys = Array.newInstance(keyType(), len);
-        Object newVals = Array.newInstance(valueType(), len);
+        Object newKeys = EList.newArray(keyType(), len);
+        Object newVals = EList.newArray(valueType(), len);
         for (int i = 0; i < len; i++) {
             int oldI = permutation[i].intValue();
             Array.set(newKeys, i, Array.get(oldKeys, oldI));



1.15      +3 -4      e/src/jsrc/org/erights/e/elib/tables/FlexListImpl.java

Index: FlexListImpl.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/FlexListImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- FlexListImpl.java	2001/12/02 06:01:47	1.14
+++ FlexListImpl.java	2001/12/12 06:35:58	1.15
@@ -69,7 +69,7 @@
      */
     public ConstList snapshot() {
         Class valType = valueType();
-        Object array = Array.newInstance(valType, mySize);
+        Object array = newArray(valType, mySize);
         System.arraycopy(myVals, 0, array, 0, mySize);
         if (valType == Character.TYPE) {
             return Twine.fromString(new String((char[])array));
@@ -199,7 +199,7 @@
     private void zero(int start, int bound) {
         int len = bound - start;
         //XXX there's gotta be a cheaper way to do this
-        Object zeros = Array.newInstance(valueType(), len);
+        Object zeros = newArray(valueType(), len);
         System.arraycopy(zeros, 0, myVals, start, len);
     }
 
@@ -223,8 +223,7 @@
                 //This capacity + newSize rule needs to be examined.
                 //It will at least double, and it will be big enough,
                 //so maybe it's fine.
-                Object newVals = Array.newInstance(valueType(),
-                                                   capacity + newSize);
+                Object newVals = newArray(valueType(), capacity + newSize);
                 System.arraycopy(myVals, 0, newVals, 0, mySize);
                 myVals = newVals;
             }



1.15      +2 -2      e/src/jsrc/org/erights/e/elib/tables/ScalarColumn.java

Index: ScalarColumn.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ScalarColumn.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ScalarColumn.java	2001/12/02 06:01:47	1.14
+++ ScalarColumn.java	2001/12/12 06:35:58	1.15
@@ -41,7 +41,7 @@
      */
     /*package*/
     ScalarColumn(Class memberType, int capacity) {
-        this(Array.newInstance(memberType, capacity));
+        this(EList.newArray(memberType, capacity));
     }
 
     /**
@@ -57,7 +57,7 @@
      */
     protected Column diverge(Class membType) {
         int len = capacity();
-        Object array = Array.newInstance(membType, len);
+        Object array = EList.newArray(membType, len);
         System.arraycopy(myArray, 0, array, 0, len);
         return new ScalarColumn(array);
     }



1.10      +2 -1      e/src/jsrc/org/erights/e/meta/java/lang/ArrayGuardSugar.java

Index: ArrayGuardSugar.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/meta/java/lang/ArrayGuardSugar.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ArrayGuardSugar.java	2001/11/11 23:32:17	1.9
+++ ArrayGuardSugar.java	2001/12/12 06:35:58	1.10
@@ -24,6 +24,7 @@
 import org.erights.e.elib.base.ClassDesc;
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.util.OneArgFunc;
 
 import java.lang.reflect.Array;
@@ -56,7 +57,7 @@
             //Note: the following works only under the assumption that
             //arrays are immutable and have no EQ identity.
             int len = Array.getLength(specimen);
-            Object result = Array.newInstance(elType, len);
+            Object result = EList.newArray(elType, len);
             for (int i = 0; i < len; i++) {
                 Object el = Array.get(specimen, i);
                 //XXX what about array of void?



1.6       +17 -47    e/src/jsrc/org/quasiliteral/astro/ASTBuilder.java

Index: ASTBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/ASTBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ASTBuilder.java	2001/12/10 20:30:09	1.5
+++ ASTBuilder.java	2001/12/12 06:35:58	1.6
@@ -34,7 +34,7 @@
     }
 
     /**
-     *
+     * @return :AstroToken
      */
     protected Astro leafInternal(AstroTag tag,
                                  Object optData,
@@ -42,65 +42,45 @@
         return new AstroToken(tag, optData, source);
     }
 
-    /**
-     * @param func :(AstroToken | AstroAST)
-     * @return :AstroAST
-     */
-    public Astro node(Astro leaf) {
-        if (leaf instanceof AstroAST) {
-            return leaf;
-        }
-        return new AstroAST((AstroToken)leaf);
-    }
-
     /**
-     * @param func :AstroToken
-     * @param args :(AstroAST | null)
+     * @param functor :(AstroAST | AstroToken)
+     * @param optArgs :(AstroAST | null)
      * @return :AstroAST
      */
-    public Astro node(Astro leaf, Object args) {
-        AstroToken funcToken = (AstroToken)leaf;
-        AstroAST optArgs = (AstroAST)args;
-        AstroAST result = new AstroAST(funcToken);
-        for (; null != optArgs; optArgs = (AstroAST)optArgs.getNextSibling()) {
-            result.addChild(optArgs);
+    public Astro term(Astro functor, Object optArgs) {
+        AstroAST result;
+        if (functor instanceof AstroAST) {
+            result = (AstroAST)functor;
+        } else {
+            result = new AstroAST((AstroToken)functor);
         }
+        //If optArgs is null, this does the right thing.
+        //setChild preserves optArgs's right-sibling-chain, as it should
+        result.setFirstChild((AstroAST)optArgs);
         return result;
     }
 
     /**
      * @return null
      */
-    public Object argList() {
+    public Object list() {
         return null;
     }
 
-    /**
-     * Returns 'first' after severing its nest sibling pointer
-     *
-     * @param first :AstroAST
-     * @return :AstroAST
-     */
-    public Object argList(AstroArg first) {
-        AstroAST result = (AstroAST)first;
-        result.setNextSibling(null);
-        return result;
-    }
-
     /**
-     * Modifies the last sibling in 'list' to be 'next', which is modified to
-     * not have any further siblings.
+     * Modifies the last sibling in 'list' to be 'next', which itself is
+     * modified to not have any further siblings.
      *
      * @param list :(AstroAST | null)
      * @param next :AstroAST
      * @return :AstroAST
      */
-    public Object argList(Object list, AstroArg next) {
+    public Object with(Object list, AstroArg next) {
         AstroAST optList = (AstroAST)list;
         AstroAST nextNode = (AstroAST)next;
         nextNode.setNextSibling(null);
         if (null == optList) {
-            return next;
+            return nextNode;
         }
         AstroAST sib = optList;
         while (true) {
@@ -111,15 +91,5 @@
             }
             sib = optNextSib;
         }
-    }
-
-    /**
-     * Just an identity function on AstroASTs
-     *
-     * @param node :AstroAST
-     * @return :AstroAST
-     */
-    public AstroArg arg(Astro node) {
-        return (AstroAST)node;
     }
 }



1.9       +1 -1      e/src/jsrc/org/quasiliteral/astro/Astro.java

Index: Astro.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/Astro.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Astro.java	2001/12/10 06:11:03	1.8
+++ Astro.java	2001/12/12 06:35:58	1.9
@@ -16,7 +16,7 @@
  *
  * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
  */
-public interface Astro {
+public interface Astro extends AstroArg {
 
     /**
      * Builds an Astro tree like this one, but the kind of Astro that's made



1.5       +16 -23    e/src/jsrc/org/quasiliteral/astro/AstroAST.java

Index: AstroAST.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroAST.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AstroAST.java	2001/12/10 20:30:09	1.4
+++ AstroAST.java	2001/12/12 06:35:58	1.5
@@ -22,7 +22,7 @@
  * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
  * @author Based on Danfuzz Bornstein's TokenAST
  */
-public class AstroAST extends BaseAST implements Astro, AstroArg {
+public class AstroAST extends BaseAST implements Astro {
 
     /**
      *
@@ -65,19 +65,15 @@
      */
     public Astro build(AstroBuilder builder) {
         Astro func = myOptToken.build(builder);
-        AstroAST optSub = (AstroAST)getFirstChild();
-        if (null == optSub) {
-            //This case is broken out in order to allow 'func' to be a Node
-            //rather than a Leaf.  This would happen is myOptToken is
-            //a composite.
-            return builder.node(func);
-        }
-        Object args = builder.argList();
-        for (; null != optSub; optSub = (AstroAST)optSub.getNextSibling()) {
-            args = builder.argList(args,
-                                   builder.arg(optSub.build(builder)));
+
+        Object args = builder.list();
+        for (AstroAST optSub = (AstroAST)getFirstChild();
+             null != optSub;
+             optSub = (AstroAST)optSub.getNextSibling()) {
+
+            args = builder.with(args, optSub.build(builder));
         }
-        return builder.node(func, args);
+        return builder.term(func, args);
     }
 
     /**
@@ -99,18 +95,15 @@
             short tagCode = AstroTag.typeCode2tagCode(self.getType());
             Astro func = builder.leafTag(schema.getOptTagForCode(tagCode),
                                          Twine.fromString(self.getText()));
-            AST optSub = self.getFirstChild();
-            if (null == optSub) {
-                //See comment in build/1 above
-                return builder.node(func);
-            }
-            Object args = builder.argList();
-            for (; null != optSub; optSub = optSub.getNextSibling()) {
+
+            Object args = builder.list();
+            for (AST optSub = self.getFirstChild();
+                 null != optSub;
+                 optSub = optSub.getNextSibling()) {
 
-                args = builder.argList(args,
-                                       builder.arg(build(optSub, builder)));
+                args = builder.with(args, build(optSub, builder));
             }
-            return builder.node(func, args);
+            return builder.term(func, args);
         }
     }
 



1.2       +3 -1      e/src/jsrc/org/quasiliteral/astro/AstroArg.java

Index: AstroArg.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroArg.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AstroArg.java	2001/12/06 06:25:08	1.1
+++ AstroArg.java	2001/12/12 06:35:58	1.2
@@ -7,7 +7,9 @@
  * <p>
  * Normally this is the same type as {@link Astro} (as in the AST and Term
  * trees).  But this is made a separate type for QuasiTerm trees, where they
- * can represent a pattern or generator for some number of Astros.
+ * can represent a pattern or generator for some number of Astros.  But it is
+ * a supertype of Astro, since an Astro can always be provided where an
+ * AstroArgs is required -- the Astro represents one AstroArg.
  *
  * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
  */



1.6       +35 -34    e/src/jsrc/org/quasiliteral/astro/AstroBuilder.java

Index: AstroBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AstroBuilder.java	2001/12/10 16:55:33	1.5
+++ AstroBuilder.java	2001/12/12 06:35:58	1.6
@@ -28,13 +28,6 @@
     AstroSchema getSchema();
 
     /**
-     * Turns a leaf Astro ('token') as produced by the lexer or the leaf
-     * methods below into an Astro suitable for use in other (node and arg)
-     * methods.
-     */
-    Astro functor(Astro token);
-
-    /**
      * Makes a leaf (eg, a Token) not representing literal data, but just a
      * token tag (token type indicator) as identified by 'tag'.
      * <p>
@@ -49,8 +42,8 @@
      * is a leaf according to 'data'.
      * <p>
      * Is equivalent to:<pre>
-     *     node(leafTag(typeCode, src),
-     *          argList(node(leafData(data, src))))
+     *     term(leafTag(typeCode, src),
+     *          list(term(leafData(data, src))))
      * </pre>
      * Exists to support legacy usage of Antlr Tokens, and in order to allow
      * lexers, which wish to emit composites, to still emit only Tokens if
@@ -100,68 +93,76 @@
     Astro leafTwine(Twine data, Twine source);
 
     /**
-     * At the Astro-level of semantics, for leaf Astros, this is an identity
-     * function.
-     * <p>
-     * However, for kinds of trees for which there are separate types to
-     * represent leaves and internal nodes (eg, Antlr's Tokens vs ASTs), if
-     * 'leaf' is of the leaf-specific type, this will convert to the node
-     * type.
-     */
-    Astro node(Astro leaf);
-
-    /**
      * Returns an internal node (eg, an AST or Term), for which 'leaf' is the
      * functor and 'args' are the arguments.
      * <p>
      * 'leaf' must be a leaf (have no arguments).
      * <p>
      * May be destructive of 'leaf' and 'args'.
+     * <p>
+     * When parsing the term syntax, this is called if the empty args list
+     * appears explicitly, but not if it's left out.  When usad as a
+     * quasi-term pattern, this allows us to distinguish between
+     * a) 'term`@foo`' and b) 'term`@foo()`'.  #a matches any term, while
+     * #b matches only zero-arity terms.  Note that
+     * c) 'term`@foo(*)`' or d) 'term`@foo(@args*)`' will also match any term,
+     * but in these cases, 'foo' will only be bound to the functor of the
+     * specimen, not, as in #a, the specimen as a whole.  (In #c, the
+     * arguments are matched and ignored.  In #d, 'args' is bound to the list
+     * of arguments.)
+     * <p>
+     * Similarly, this allows us to distinguish between the expressions
+     * e) 'term`$foo`' and f) 'term`$foo()`'.  On success, both #e and #f mean
+     * the same thing.  But #f additionally required the term bound to 'foo'
+     * to be zero-arity, or an exception will be thrown.
      *
      * @param args :Args
      */
-    Astro node(Astro leaf, Object args);
+    Astro term(Astro leaf, Object args);
 
     /**
      * The empty args list
      *
      * @return :Args
      */
-    Object argList();
+    Object list();
 
     /**
      * The args list of one element.
      * <p>
      * May be destructive of that element, as when it's an AST.
      * <p>
-     * Should be equivalent to 'argList(argList(), first)'
+     * Should be equivalent to 'with(list(), first)'
      *
      * @return :Args
+     */
+    Object list(AstroArg first);
+
+    /**
+     * The two-argument args list
      */
-    Object argList(AstroArg first);
+    Object list(AstroArg first, AstroArg second);
 
     /**
+     * The three-argument args list
+     */
+    Object list(AstroArg first, AstroArg second, AstroArg third);
+
+    /**
      * Extend args list with an additional term, like a backwards cons.
      * <p>
      * May be destructive of 'list' and 'next'
      *
      * @param list :Args
      * @return :Args
-     */
-    Object argList(Object list, AstroArg next);
-
-    /**
-     * Converts an Astro into a corresponding AstroArgs.
-     * <p>
-     * When an Astro and an AstroArg are the same, this is an identity
-     * function.  Otherwise, this converts 'node' into an arg
-     * representing the singleton list consisting of just node.
      */
-    AstroArg arg(Astro node);
+    Object with(Object list, AstroArg next);
 
     /**
      * Turns the string into a list of arguments representing each character
      * as a character literal.
+     *
+     * @return :Args
      */
     Object unpack(Astro litString);
 }



1.15      +1 -1      e/src/jsrc/org/quasiliteral/astro/AstroToken.java

Index: AstroToken.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroToken.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AstroToken.java	2001/12/10 20:30:09	1.14
+++ AstroToken.java	2001/12/12 06:35:58	1.15
@@ -18,7 +18,7 @@
  * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
  * @author Based on ValueExtentToken by Danfuzz Bornstein
  */
-public class AstroToken extends Token implements Astro, AstroArg {
+public class AstroToken extends Token implements Astro {
 
     /**
      *



1.3       +12 -7     e/src/jsrc/org/quasiliteral/astro/BaseBuilder.java

Index: BaseBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/BaseBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BaseBuilder.java	2001/12/10 16:55:33	1.2
+++ BaseBuilder.java	2001/12/12 06:35:59	1.3
@@ -32,13 +32,6 @@
     }
 
     /**
-     * Defaults to the identity function
-     */
-    public Astro functor(Astro token) {
-        return token;
-    }
-
-    /**
      * Actually makes the kind of leaf this builder makes.
      * <p>
      * This is 'internal*' and 'protected' because it assumes that the
@@ -124,6 +117,18 @@
         return leafInternal(mySchema.getLiteralStringTag(),
                               data,
                               source);
+    }
+
+    public Object list(AstroArg first) {
+        return with(list(), first);
+    }
+
+    public Object list(AstroArg first, AstroArg second) {
+        return with(list(first), second);
+    }
+
+    public Object list(AstroArg first, AstroArg second, AstroArg third) {
+        return with(list(first, second), third);
     }
 
     /**



1.4       +1 -1      e/src/jsrc/org/quasiliteral/quasiterm/QuasiBuilder.java

Index: QuasiBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QuasiBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- QuasiBuilder.java	2001/12/10 20:30:09	1.3
+++ QuasiBuilder.java	2001/12/12 06:36:00	1.4
@@ -65,7 +65,7 @@
      *
      * @param args is a list of AstroArg.
      */
-    AstroArg argGroup(Object args, String quant);
+    AstroArg group(Object args, String quant);
 
     /**
      * On substitution, "evaluates" to 'args[litInt]'.



1.6       +13 -17    e/src/jsrc/org/quasiliteral/quasiterm/QuasiBuilderAdaptor.java

Index: QuasiBuilderAdaptor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QuasiBuilderAdaptor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- QuasiBuilderAdaptor.java	2001/12/10 20:30:09	1.5
+++ QuasiBuilderAdaptor.java	2001/12/12 06:36:00	1.6
@@ -53,10 +53,6 @@
         return myBuilder.getSchema();
     }
 
-    public Astro functor(Astro token) {
-        return myBuilder.functor(token);
-    }
-
     public Astro leafTag(AstroTag tag, Twine source) {
         return myBuilder.leafTag(tag, source);
     }
@@ -93,28 +89,28 @@
         return myBuilder.leafTwine(data, source);
     }
 
-    public Astro node(Astro leaf) {
-        return myBuilder.node(leaf);
+    public Astro term(Astro leaf, Object args) {
+        return myBuilder.term(leaf, args);
     }
 
-    public Astro node(Astro leaf, Object args) {
-        return myBuilder.node(leaf, args);
+    public Object list() {
+        return myBuilder.list();
     }
 
-    public Object argList() {
-        return myBuilder.argList();
+    public Object list(AstroArg first) {
+        return myBuilder.list(first);
     }
 
-    public Object argList(AstroArg first) {
-        return myBuilder.argList(first);
+    public Object list(AstroArg first, AstroArg second) {
+        return myBuilder.list(first, second);
     }
 
-    public Object argList(Object list, AstroArg next) {
-        return myBuilder.argList(list, next);
+    public Object list(AstroArg first, AstroArg second, AstroArg third) {
+        return myBuilder.list(first, second, third);
     }
 
-    public AstroArg arg(Astro node) {
-        return myBuilder.arg(node);
+    public Object with(Object list, AstroArg next) {
+        return myBuilder.with(list, next);
     }
 
     public Object unpack(Astro litString) {
@@ -137,7 +133,7 @@
         throw new RuntimeException("not quasi-ing");
     }
 
-    public AstroArg argGroup(Object args, String quant) {
+    public AstroArg group(Object args, String quant) {
         throw new RuntimeException("not quasi-ing");
     }
 



1.16      +5 -9      e/src/jsrc/org/quasiliteral/term/Term.java

Index: Term.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/Term.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Term.java	2001/12/10 20:30:10	1.15
+++ Term.java	2001/12/12 06:36:00	1.16
@@ -38,8 +38,7 @@
  * @author Many thanks also to Dean Tribble
  */
 public class Term
-  implements Selfless, PassByConstruction, Persistent,
-  Astro, AstroArg {
+  implements Selfless, PassByConstruction, Persistent, Astro {
 
     /**
      *
@@ -131,16 +130,13 @@
             //Assumes tag adds no more info.
             func = builder.leafData(myOptData, mySource);
         }
-        Object args = builder.argList();
+        Object args = builder.list();
         int len = myArgs.size();
-        if (0 == len) {
-            return builder.node(func);
-        }
         for (int i = 0; i < len; i++) {
-            AstroArg arg = builder.arg(((Term)myArgs.get(i)).build(builder));
-            args = builder.argList(args, arg);
+            Astro arg = ((Term)myArgs.get(i)).build(builder);
+            args = builder.with(args, arg);
         }
-        return builder.node(func, args);
+        return builder.term(func, args);
     }
 
     /**



1.16      +5 -54     e/src/jsrc/org/quasiliteral/term/TermBuilder.java

Index: TermBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/TermBuilder.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TermBuilder.java	2001/12/10 20:30:10	1.15
+++ TermBuilder.java	2001/12/12 06:36:00	1.16
@@ -55,23 +55,6 @@
     }
 
     /**
-     * Transform 'ID(foo)' into 'foo'.
-     * <p>
-     * Otherwise, is an identity function
-     */
-    public Astro functor(Astro token) {
-        if (token.getTag().getTagName() == "ID") {
-            //the above test is valid, since tagNames are guaranteed to be
-            //interned.
-            String name = ((Twine)token.getOptArgData()).bare();
-            AstroTag nameTag = getSchema().obtainTagForName(name);
-            return leafTag(nameTag, token.getSource());
-        } else {
-            return token;
-        }
-    }
-
-    /**
      *
      */
     protected Astro leafInternal(AstroTag tag,
@@ -84,20 +67,8 @@
     }
 
     public Astro composite(AstroTag tag, Object data, Twine source) {
-        return node(leafTag(tag, source),
-                    argList(arg(leafData(data, source))));
-    }
-
-    /**
-     * @param func :Term with no arguments
-     * @return :Term
-     */
-    public Astro node(Astro leaf) {
-        Term result = (Term)leaf;
-        E.require(result.getArgs().size() == 0,
-                  "To use as a functor, a Term must not have args: ",
-                  result);
-        return result;
+        return term(leafTag(tag, source),
+                    list(leafData(data, source)));
     }
 
     /**
@@ -105,7 +76,7 @@
      * @param args :(FlexList of(Term))
      * @return :Term
      */
-    public Astro node(Astro leaf, Object args) {
+    public Astro term(Astro leaf, Object args) {
         Term func = (Term)leaf;
         E.require(func.getArgs().size() == 0,
                   "To use as a functor, a Term must not have args: ",
@@ -123,23 +94,11 @@
      *
      * @return :(FlexList of(Term))
      */
-    public Object argList() {
+    public Object list() {
         return FlexList.fromType(Term.class);
     }
 
     /**
-     * Returns a new FlexList containing only 'first'.
-     *
-     * @param first :Term
-     * @return :(FlexList of(Term))
-     */
-    public Object argList(AstroArg first) {
-        FlexList result = FlexList.fromType(Term.class);
-        result.push(first);
-        return result;
-    }
-
-    /**
      * 'list' is consumed (should no longer be considered valid by the caller)
      * in order to efficiently produce the output.
      * <p>
@@ -149,17 +108,9 @@
      * @param next :Term
      * @return :(FlexList of(Term))
      */
-    public Object argList(Object list, AstroArg next) {
+    public Object with(Object list, AstroArg next) {
         FlexList argList = (FlexList)E.as(list, FlexList.class);
         argList.push(next);
         return argList;
-    }
-
-    /**
-     * @param node :Term
-     * @return :Term
-     */
-    public AstroArg arg(Astro node) {
-        return (Term)node;
     }
 }



1.15      +51 -54    e/src/jsrc/org/quasiliteral/term/TermParser.java

Index: TermParser.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/TermParser.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TermParser.java	2001/12/10 16:55:33	1.14
+++ TermParser.java	2001/12/12 06:36:00	1.15
@@ -19,12 +19,13 @@
 import org.quasiliteral.astro.BaseSchema;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroArg;
+import org.quasiliteral.astro.AstroTag;
 import org.quasiliteral.quasiterm.QuasiBuilder;
 import org.quasiliteral.quasiterm.QuasiBuilderAdaptor;
 import org.quasiliteral.syntax.SyntaxException;
 
 import java.io.IOException;
-//#line 26 "TermParser.java"
+//#line 27 "TermParser.java"
 
 
 
@@ -304,7 +305,7 @@
 "functorHole : '@' '{' LiteralInteger '}'",
 };
 
-//#line 137 "term.y"
+//#line 138 "term.y"
 
 
 /**
@@ -394,7 +395,27 @@
     }
 }
 
+/**
+ * Transform 'ID(foo)' into 'foo'.
+ * <p>
+ * Otherwise, is an identity function.  This is needed for the
+ * TermParser specifically, since identifiers in the input must all be
+ * of token tag-name ID, while each of these represents a unique
+ * keyword, and therefore token-tag, in the grammar being described.
+ */
+private Astro untag(Astro token) {
+    if (token.getTag().getTagName() == "ID") {
+        //the above test is valid, since tagNames are guaranteed to be
+        //interned.
+        String name = ((Twine)token.getOptArgData()).bare();
+        AstroTag nameTag = b.getSchema().obtainTagForName(name);
+        return b.leafTag(nameTag, token.getSource());
+    } else {
+        return token;
+    }
+}
 
+
 /*********************************/
 
 /**
@@ -447,7 +468,7 @@
 static public final AstroSchema DEFAULT_SCHEMA =
   new BaseSchema("Term-Tree-Language", ConstList.fromArray(TheTokens));
 
-//#line 399 "TermParser.java"
+//#line 420 "TermParser.java"
 //###############################################################
 // method: yylexdebug : check lexer state
 //###############################################################
@@ -594,110 +615,86 @@
       {
 //########## USER-SUPPLIED ACTIONS ##########
 case 1:
-//#line 74 "term.y"
+//#line 75 "term.y"
 { myOptResult = val_peek(0); }
 break;
-case 2:
-//#line 78 "term.y"
-{ yyval = b.node((Astro)val_peek(0)); }
-break;
 case 3:
-//#line 79 "term.y"
-{ yyval = b.node((Astro)val_peek(3), val_peek(1)); }
+//#line 80 "term.y"
+{ yyval = b.term((Astro)val_peek(3), val_peek(1)); }
 break;
 case 4:
-//#line 80 "term.y"
-{ yyval = b.node((Astro)val_peek(3), val_peek(1)); }
+//#line 81 "term.y"
+{ yyval = b.term((Astro)val_peek(3), val_peek(1)); }
 break;
 case 5:
-//#line 82 "term.y"
+//#line 83 "term.y"
 { yyval = b.termHole(null,      (Astro)val_peek(0)); }
 break;
 case 6:
-//#line 83 "term.y"
+//#line 84 "term.y"
 { yyval = b.termHole((Astro)val_peek(1), (Astro)val_peek(0)); }
 break;
 case 7:
-//#line 87 "term.y"
-{ yyval = b.argList(); }
+//#line 88 "term.y"
+{ yyval = b.list(); }
 break;
 case 9:
-//#line 92 "term.y"
-{ yyval = b.argList((AstroArg)val_peek(0)); }
+//#line 93 "term.y"
+{ yyval = b.list((AstroArg)val_peek(0)); }
 break;
 case 10:
-//#line 93 "term.y"
-{ yyval = b.argList(val_peek(2), (AstroArg)val_peek(0)); }
+//#line 94 "term.y"
+{ yyval = b.with(val_peek(2), (AstroArg)val_peek(0)); }
 break;
 case 12:
-//#line 98 "term.y"
+//#line 99 "term.y"
 { yyval = b.alt((AstroArg)val_peek(2), (AstroArg)val_peek(0));}
 break;
-case 13:
-//#line 105 "term.y"
-{ yyval = b.arg((Astro)val_peek(0)); }
-break;
 case 14:
-//#line 106 "term.y"
+//#line 107 "term.y"
 { yyval = b.seq((Astro)val_peek(1), (String)val_peek(0)); }
 break;
 case 15:
-//#line 107 "term.y"
+//#line 108 "term.y"
 { yyval = b.seq(null,      (String)val_peek(0)); }
 break;
 case 16:
-//#line 108 "term.y"
+//#line 109 "term.y"
 { yyval = b.seq(null,      "."); }
 break;
 case 17:
-//#line 109 "term.y"
-{ yyval = b.argGroup(val_peek(2),   (String)val_peek(0)); }
+//#line 110 "term.y"
+{ yyval = b.group(val_peek(2),      (String)val_peek(0)); }
 break;
 case 18:
-//#line 110 "term.y"
+//#line 111 "term.y"
 { yyval = b.unpack((Astro)val_peek(0)); }
 break;
 case 19:
-//#line 114 "term.y"
+//#line 115 "term.y"
 { yyval = "?"; }
 break;
 case 20:
-//#line 115 "term.y"
+//#line 116 "term.y"
 { yyval = "+"; }
 break;
 case 21:
-//#line 116 "term.y"
+//#line 117 "term.y"
 { yyval = "*"; }
 break;
 case 22:
-//#line 120 "term.y"
-{ yyval = b.functor((Astro)val_peek(0)); }
-break;
-case 23:
 //#line 121 "term.y"
-{ yyval = b.functor((Astro)val_peek(0)); }
+{ yyval = untag((Astro)val_peek(0)); }
 break;
-case 24:
-//#line 122 "term.y"
-{ yyval = b.functor((Astro)val_peek(0)); }
-break;
-case 25:
-//#line 123 "term.y"
-{ yyval = b.functor((Astro)val_peek(0)); }
-break;
-case 26:
-//#line 124 "term.y"
-{ yyval = b.functor((Astro)val_peek(0)); }
-break;
 case 27:
-//#line 131 "term.y"
+//#line 132 "term.y"
 { yyval = b.dollarHole((Astro)val_peek(1)); }
 break;
 case 28:
-//#line 132 "term.y"
+//#line 133 "term.y"
 { yyval = b.atHole(    (Astro)val_peek(1)); }
 break;
-//#line 646 "TermParser.java"
+//#line 643 "TermParser.java"
 //########## END OF USER-SUPPLIED ACTIONS ##########
     }//switch
     //#### Now let's reduce... ####



1.14      +34 -13    e/src/jsrc/org/quasiliteral/term/term.y

Index: term.y
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/term.y,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- term.y	2001/12/10 16:55:33	1.13
+++ term.y	2001/12/12 06:36:00	1.14
@@ -14,6 +14,7 @@
 import org.quasiliteral.astro.BaseSchema;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroArg;
+import org.quasiliteral.astro.AstroTag;
 import org.quasiliteral.quasiterm.QuasiBuilder;
 import org.quasiliteral.quasiterm.QuasiBuilderAdaptor;
 import org.quasiliteral.syntax.SyntaxException;
@@ -75,22 +76,22 @@
 ;
 
 term:
-        functor                      { $$ = b.node((Astro)$1); }
- |      functor     '(' argList ')'  { $$ = b.node((Astro)$1, $3); }
- |      functorHole '(' argList ')'  { $$ = b.node((Astro)$1, $3); }
+        functor
+ |      functor     '(' argList ')'  { $$ = b.term((Astro)$1, $3); }
+ |      functorHole '(' argList ')'  { $$ = b.term((Astro)$1, $3); }
 
  |         functorHole               { $$ = b.termHole(null,      (Astro)$1); }
  |      ID functorHole               { $$ = b.termHole((Astro)$1, (Astro)$2); }
  ;
 
 argList:
-        /* empty */                  { $$ = b.argList(); }
+        /* empty */                  { $$ = b.list(); }
  |      args
  ;
 
 args:
-        arg                          { $$ = b.argList((AstroArg)$1); }
- |      args ',' arg                 { $$ = b.argList($1, (AstroArg)$3); }
+        arg                          { $$ = b.list((AstroArg)$1); }
+ |      args ',' arg                 { $$ = b.with($1, (AstroArg)$3); }
  ;
 
 arg:
@@ -102,11 +103,11 @@
  * Each seq represents some number of Terms
  */
 seq:
-        term                         { $$ = b.arg((Astro)$1); }
+        term                         // An Astro is already a fine AstroArg
  |      term quant                   { $$ = b.seq((Astro)$1, (String)$2); }
  |           quant                   { $$ = b.seq(null,      (String)$1); }
  |           '.'                     { $$ = b.seq(null,      "."); }
- |      '(' args ')' quant           { $$ = b.argGroup($2,   (String)$4); }
+ |      '(' args ')' quant           { $$ = b.group($2,      (String)$4); }
  |      '^' LiteralString            { $$ = b.unpack((Astro)$2); }
  ;
 
@@ -117,11 +118,11 @@
  ;
 
 functor:
-        ID                           { $$ = b.functor((Astro)$1); }
- |      LiteralChar                  { $$ = b.functor((Astro)$1); }
- |      LiteralInteger               { $$ = b.functor((Astro)$1); }
- |      LiteralFloat64               { $$ = b.functor((Astro)$1); }
- |      LiteralString                { $$ = b.functor((Astro)$1); }
+        ID                           { $$ = untag((Astro)$1); }
+ |      LiteralChar
+ |      LiteralInteger
+ |      LiteralFloat64
+ |      LiteralString
  ;
 
 /**
@@ -220,6 +221,26 @@
         myLexer.syntaxError("Unexpected EOF");
     } else {
         myLexer.syntaxError(s);
+    }
+}
+
+/**
+ * Transform 'ID(foo)' into 'foo'.
+ * <p>
+ * Otherwise, is an identity function.  This is needed for the
+ * TermParser specifically, since identifiers in the input must all be
+ * of token tag-name ID, while each of these represents a unique
+ * keyword, and therefore token-tag, in the grammar being described.
+ */
+private Astro untag(Astro token) {
+    if (token.getTag().getTagName() == "ID") {
+        //the above test is valid, since tagNames are guaranteed to be
+        //interned.
+        String name = ((Twine)token.getOptArgData()).bare();
+        AstroTag nameTag = b.getSchema().obtainTagForName(name);
+        return b.leafTag(nameTag, token.getSource());
+    } else {
+        return token;
     }
 }