Beispiel #1
0
        public override string VisitDirectivaInicio([NotNull] SicAsmParser.DirectivaInicioContext context)
        {
            string label      = context.LABEL().GetText();
            int    addr_value = 0;

            if (context.INT() != null)
            {
                addr_value = int.Parse(context.INT().GetText());
            }
            if (context.HEX() != null)
            {
                string hex_str = context.HEX().GetText().Remove(context.HEX().GetText().Length - 1);
                addr_value = int.Parse(hex_str, System.Globalization.NumberStyles.HexNumber);
            }

            if (_is_first_pass)
            {
                _prog_name = label;
                _prog_size = addr_value;
            }


            if (addr_value <= MAX_ADDR)
            {
                _program_counter = addr_value;
            }
            else
            {
                return("Error, dirección fuera de rango, debe ser menor o igual a 0x7FFF");
            }


            /* cehcar si la direccion es menor a 0x7FFF*/

            return(label + addr_value);
        }
Beispiel #2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>DirectivaInicio</c>
 /// labeled alternative in <see cref="SicAsmParser.start"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitDirectivaInicio([NotNull] SicAsmParser.DirectivaInicioContext context)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Visit a parse tree produced by the <c>DirectivaInicio</c>
 /// labeled alternative in <see cref="SicAsmParser.start"/>.
 /// <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 VisitDirectivaInicio([NotNull] SicAsmParser.DirectivaInicioContext context)
 {
     return(VisitChildren(context));
 }