public override IAstNode VisitReadStmt(MicroCParser.ReadStmtContext context)
        {
            var          label    = ++_label;
            string       name     = context.IDENT().GetText();
            var          symbol   = _symbolTable.LookupSymbol(name);
            var          ident    = new Identifier(symbol.Name, symbol.Type, symbol.Id);
            IStateAccess sa       = new VarAccess(ident);
            var          readStmt = new ReadStmt(sa);

            readStmt.Label = label;
            return(readStmt);
        }
Example #2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>readStmt</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 ExitReadStmt([NotNull] MicroCParser.ReadStmtContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by the <c>readStmt</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 VisitReadStmt([NotNull] MicroCParser.ReadStmtContext context)
 {
     return(VisitChildren(context));
 }