tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

js.mjs (730B)


      1 import {Graph} from '../../demo-site/dist/graph.js';
      2 import {loadBundle} from '../../demo-site/dist/bundle.js';
      3 import {text,readText} from '../../demo-site/dist/codecs.js';
      4 import {treeSession} from '../tree-session.mjs';
      5 export function create({bundle,name}) {
      6   // Finite harness caps, not site settings. This adapter is not yet deployed.
      7   const graph=new Graph({nodes:6_000_000,fuel:Infinity,stack:100_000},{threshold:250_000});
      8   const root=loadBundle(graph,bundle).get(name);
      9   return treeSession(graph,root,{
     10     scope:fn=>fn({keep:x=>x}),release(){},
     11     ofText:(value,limit)=>text(graph,value,limit),toText:value=>readText(graph,value),
     12     collect:roots=>graph.collect(roots),stats:()=>graph.stats,dispose(){},
     13   });
     14 }