public override void CaseAVarDecl(AVarDecl node) { Declaration d = mEnv.CurrentScope.Lookup(node); mOutputFile.Add(d); base.CaseAVarDecl(node); }
public void Add(AVarDecl var) { Declaration tv = new Declaration(var, var.GetType(), var.GetName().Text); mNamedTypes.Add(var, tv); mLookupTable.Add(var.GetName().Text, tv); }
public override void OutAVarDecl(AVarDecl node) { if (node.GetInit() != null) { // initializer must be an assigment. Handled by grammar } base.OutAVarDecl(node); }
public VariableShell(AVarDecl decl, RuntimeEnvironment env) { Name = decl.GetName().ToString(); //if (decl.GetInit() != null && env.GetGlobalScope().ContainsExpression(decl.GetInit())) //{ // Value = env.GetGlobalScope().GetValueOfExpression(decl.GetInit()); //} }
public bool Contains(AVarDecl var) { if (var != null) { return(mNamedTypes.ContainsKey(var)); } else { return(false); } }
public override void CaseAVarDecl(AVarDecl node) { // check: variable initializer is a InitExp PExp exp = node.GetInit(); if (exp != null) { if (exp.GetType() != typeof(AInitExp)) { Error.Fatal(ErrorType.InvalidInitializer, node.GetName()); } } base.CaseAVarDecl(node); }
public override void OutAVarDecl(AVarDecl node) { // check init condition if any. if (node.GetInit() != null) { if (mEnv.CurrentScope.Contains(node.GetInit())) { long value = mEnv.CurrentScope.GetValueOf(node.GetInit()); mEnv.CurrentScope.SetValueOf(node, value); } else { throw new Exception("Unresolveable initcondition"); } } base.OutAVarDecl(node); }
public Declaration Lookup(AVarDecl decl) { return(Lookup(decl.GetName().Text)); }
public override void CaseAVarDecl(AVarDecl node) { base.CaseAVarDecl(node); }
public override void CaseAVarDecl(AVarDecl node) { // add variable to scope mEnv.CurrentScope.Add(node); base.CaseAVarDecl(node); }