Ejemplo n.º 1
0
        public ASTNode ParseInstructionJmp()
        {
            //Console.WriteLine ("[PARSE] Instruction :: jmp");
            var jmp = new GenericInstructionNode ("jmp");

            // Instruction target is label
            if (Match (TokenType.Identifier)) {
                //Console.WriteLine ("[PARSE] Instruction :: jmp :: Identifier");
                var ident = Expect (TokenType.Identifier).UnboxAs<string> ();
                //Console.WriteLine ("[INFO] Target label: '{0}'", ident);
                jmp.AddChild (new LabelTargetNode (ident));
                return jmp;
            }

            // Instruction target is address
            if (MatchIsNumber ()) {
                jmp.AddChild (ParseNumber ());
                return jmp;
            }

            ThrowUnexpected ();
            return new ASTNode ();
        }
Ejemplo n.º 2
0
 public ASTNode ParseInstructionMov()
 {
     //Console.WriteLine ("[PARSE] Instruction :: mov");
     var mov = new GenericInstructionNode ("mov");
     mov.AddChild (ParseOperandAny ());
     Expect (TokenType.Comma);
     mov.AddChild (ParseOperandAny ());
     return mov;
 }