public SymbolSpace Clone() { var newSpace = new SymbolSpace(this.Parent); foreach (var k in this.Bindings.Keys) { newSpace.Bind(k, this.Bindings[k] /*.Clone()*/); } return(newSpace); }
public SymbolSpace(SymbolSpace parent, IEnumerable <Tuple <SymbolItem, Item> > bound = null) { this.Bindings = new Dictionary <string, Item>(); this.SetParent(parent); if (bound != null) { foreach (var binding in bound) { this.Bind(binding.Item1.Name, binding.Item2); } } }
public Repl() { this.parser = new Parser(); this.globalSpace = new SymbolSpace(null); this.globalSpace.Bind("*global", new SymbolSpaceItem(this.globalSpace)); var trueItem = new ValueItem(ItemType.Bool, true); var falseItem = new ValueItem(ItemType.Bool, false); this.globalSpace.Bind("*true", trueItem); this.globalSpace.Bind("*t", trueItem); this.globalSpace.Bind("*false", falseItem); this.globalSpace.Bind("*f", falseItem); BuiltIns.SetupBuiltins(this.globalSpace); }
public void SetParent(SymbolSpace space) { this.Parent = space; this.Bind(SuperString, new SymbolSpaceItem(space)); this.Bind(LocalString, new SymbolSpaceItem(this)); }