// doLoop is treated as a special case of doPlusLoop // # ( -- ) Loops back to doDo until the start equals the end public void doLoop(ref GlobalSimpleProps gsp) { gsp.DataStack.Add(1); string runTimeAction = "dPlusLoop." + gsp.BFC.ImmediateVocab; CreoleWord cw = gsp.Cfb.Dict[runTimeAction]; Codefield codeField = cw.CodeField; codeField(ref gsp); }
public void buildPrimitive(string name, Codefield codefield, string codeFieldStr, string vocab, string compAction, string help) { List <int> paramList = new List <int>(); List <object> dataList = new List <object>(); string fqName = name + "." + vocab; CreoleWord cw = new CreoleWord(name, codefield, codeFieldStr, vocab, compAction, help, Address.Count() - 1, Address.Count(), Address.Count() - 1, Address.Count(), paramList, dataList); Dict[fqName] = cw; Address.Add(cw); }
// Looks up the word based on its list index and executes whatever is in its code field public void doInner(ref GlobalSimpleProps gsp) { try { CreoleWord cw = gsp.Cfb.Address[gsp.InnerPtr]; Codefield cf = cw.CodeField; cf(ref gsp); } catch (System.IndexOutOfRangeException e) { Console.WriteLine("Error: Stack underflow " + e.ToString()); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
// Run time code for colon definitions public void doColon(ref GlobalSimpleProps gsp) { CreoleWord currWord = gsp.Cfb.Address[gsp.InnerPtr]; List <int> paramField = currWord.ParamField; while (gsp.ParamFieldPtr < paramField.Count) { int addrInPF = paramField[gsp.ParamFieldPtr]; Codefield codeField = gsp.Cfb.Address[addrInPF].CodeField; gsp.ParamFieldPtr++; ReturnLoc rLoc = new ReturnLoc(gsp.InnerPtr, gsp.ParamFieldPtr); gsp.Scratch = rLoc; gsp.Push(gsp.ReturnStack); codeField(ref gsp); rLoc = (ReturnLoc)gsp.Pop(gsp.ReturnStack); gsp.InnerPtr = rLoc.DictAddr; gsp.ParamFieldPtr = rLoc.ParamFieldAddr; } }
public CreoleWord(string namefield, Codefield codefield, string codefieldstr, string vocabulary, string compileactionfield, string helpfield, int prevrowlocfield, int rowlocfield, int linkfield, int indexfield, List <int> paramfield, List <object> datafield) { this.namefield = namefield; this.codefield = codefield; this.codefieldstr = codefieldstr; this.vocabulary = vocabulary; this.fqnamefield = namefield + "." + vocabulary; this.compileactionfield = compileactionfield; this.helpfield = helpfield; this.prevrowlocfield = prevrowlocfield; this.rowlocfield = rowlocfield; this.linkfield = linkfield; this.indexfield = indexfield; this.ParamField = paramfield; this.DataField = datafield; this.paramfieldstart = 0; }