Browse Source

Parser can now have it's Program Counter Label (PCLabel) defined. Defaults to '__PC__'. The symbole '*' is no longer used.

master
Bryan Miller 5 years ago
parent
commit
da3a8b826f
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      src/compiler/parser.js

+ 11
- 1
src/compiler/parser.js View File

} }






class Parser{ class Parser{
constructor(pof){ constructor(pof){
if (typeof(pof) !== 'function') if (typeof(pof) !== 'function')
this.__stream = null; this.__stream = null;
this.__SKIPEOL = false; this.__SKIPEOL = false;
this.__output = null; this.__output = null;
this.__PCLabel = "__PC__";
this.parseOpCode = pof(this); this.parseOpCode = pof(this);
} }


this.__SKIPEOL = false; this.__SKIPEOL = false;
} }
get stream(){return this.__stream;} get stream(){return this.__stream;}

get PCLabel(){return this.__PCLabel;}
set PCLabel(pcl){
if (typeof(pcl) !== 'string' || pcl === "")
throw new TypeError("PC Label must be a non-zero-length string.");
this.__PCLabel = pcl;
}


isPunc(ch){ isPunc(ch){
type: "assign", type: "assign",
op: "=", op: "=",
left: t, left: t,
right: "*", // To designate "current program counter".
right: this.__PCLabel, // To designate "current program counter".
line: t.line, line: t.line,
col: t.col col: t.col
} }

Loading…
Cancel
Save