public override IAstNode VisitReadArrStmt(MicroCParser.ReadArrStmtContext context) { var label = ++_label; string name = context.IDENT().GetText(); var symbol = _symbolTable.LookupSymbol(name); var ident = new Identifier(symbol.Name, symbol.Type, symbol.Id, symbol.Size); IAExpr index = Visit(context.index) as IAExpr; IStateAccess sa = new ArrayAccess(ident, index); var readStmt = new ReadStmt(sa); readStmt.Label = label; return(readStmt); }
/// <summary> /// Exit a parse tree produced by the <c>readArrStmt</c> /// labeled alternative in <see cref="MicroCParser.statement"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitReadArrStmt([NotNull] MicroCParser.ReadArrStmtContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>readArrStmt</c> /// labeled alternative in <see cref="MicroCParser.statement"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitReadArrStmt([NotNull] MicroCParser.ReadArrStmtContext context) { return(VisitChildren(context)); }