public override IAstNode VisitIntDecl(MicroCParser.IntDeclContext context)
        {
            var label   = ++_label;
            var name    = context.IDENT().GetText();
            var id      = _symbolTable.InsertSymbol(name, VarType.Int);
            var intDecl = new IntDecl(name);

            intDecl.Label = label;
            intDecl.Id    = id;
            return(intDecl);
        }
Example #2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>intDecl</c>
 /// labeled alternative in <see cref="MicroCParser.declaration"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitIntDecl([NotNull] MicroCParser.IntDeclContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by the <c>intDecl</c>
 /// labeled alternative in <see cref="MicroCParser.declaration"/>.
 /// <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 VisitIntDecl([NotNull] MicroCParser.IntDeclContext context)
 {
     return(VisitChildren(context));
 }