internal void HandleLhs(ident i, BekTypes t, bool implicitdefine = false) { SymtabElt e; if (TryGetElt(i.name, out e)) { if (implicitdefine) { throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name)); } if (e.type != t) { throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name)); } this.symtab[i] = e; } else if (implicitdefine) { e = new SymtabElt(i, t); this.AddElt(i, e); } else { throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name)); } }
Expr MkExpr(BekTypes btype, expr e) { switch (btype) { case BekTypes.BOOL: return(((boolconst)e).val ? stb.Solver.True : stb.Solver.False); case BekTypes.CHAR: return(stb.Solver.MkNumeral(((charconst)e).val, charsort)); case BekTypes.STR: return(stb.Solver.MkListFromString(((strconst)e).val, charsort)); default: throw new BekException(); //TBD: introduce exception kinds } }
Sort BekTypeToSort(BekTypes btype) { switch (btype) { case BekTypes.BOOL: return(stb.Solver.BoolSort); case BekTypes.CHAR: return(charsort); case BekTypes.STR: return(stb.Solver.MkListSort(charsort)); default: throw new BekException(); //TBD: introduce exception kinds } }
internal void HandleLhs(ident i, BekTypes t, bool implicitdefine=false) { SymtabElt e; if (TryGetElt(i.name, out e)) { if (implicitdefine) throw new BekParseException(i.line, i.pos, string.Format("'{0}' already defined", i.name)); if (e.type != t) throw new BekParseException(i.line, i.pos, string.Format("'{0}' inconsistent type", i.name)); this.symtab[i] = e; } else if (implicitdefine) { e = new SymtabElt(i, t); this.AddElt(i, e); } else { throw new BekParseException(i.line, i.pos, string.Format("'{0}' undefined", i.name)); } }
public SymtabElt(object def, BekTypes type) { this.id = nextid++; this.def = def; this.type = type; }