コード例 #1
0
ファイル: CodeGen.cs プロジェクト: bencz/Beryl
 /* VariableExpression perhaps ought to be called IdentifierExpression as it is used for both constants and variables. */
 public void visit(VariableExpression that)
 {
     Console.Write(that.Name);
 }
コード例 #2
0
ファイル: Checker.cs プロジェクト: bencz/Beryl
 /* VariableExpression perhaps ought to be called IdentifierExpression as it is used for both constants and variables. */
 public void visit(VariableExpression that)
 {
     Declaration declaration = _symbols.Lookup(that.Name);
     if (declaration == null)
         throw new CheckerError(that.Position, "Undefined constant or variable '" + that.Name + "' in expression");
     that.Type = declaration.Type;
 }