User:Kevin Reid/ASTPrint.java

// Minimal Java program attempting to set up an E-on-Java vat and do something in it. Written 2008-10-11. Doesn't work as of 2010-11-22 testing; I don't recall whether I ever finished it. Result is

// [ It probably needs a  ] — User:ThomasLeonard

import org.erights.e.elang.interp.ScopeSetup; import org.erights.e.elib.tables.Twine; import org.erights.e.elib.prim.E; import org.erights.e.elang.syntax.EParser; import org.erights.e.elang.evm.ENode; import org.erights.e.elib.serial.Loader; import org.erights.e.elib.vat.Vat; class ASTPrint { public static void main(String[] args) { try { Vat vat = Vat.make("headless", "start"); Throwable optNoStart = vat.enqueue(new Runnable {         public void run {            ENode node = EParser.run(Twine.fromString("aardvarks"));            System.out.print(node);            Loader i = (Loader)(ScopeSetup.safeScope("__main$").get("import__uriGetter"));            Object converter = E.call(i.get("org.erights.e.elang.visitors.makeConvertENode2Term"), "run");            System.out.print(E.call(converter, "run", node));          }        }); if (null != optNoStart) { throw optNoStart; }     } catch (Throwable e) { System.err.print(E.toString(e)); System.err.print(E.call(e, "eStack")); }   }  }