Esempio n. 1
0
 protected void DecArg()
 {
     if (argFSM == ArgFSM.SRC)
     {
         argFSM = ArgFSM.DST;
     }
     else
     {
         argFSM = ArgFSM.COMPLETE;
     }
 }
Esempio n. 2
0
 public void EnterMonad(GBASMParser.MonadContext context)
 {
     PrintLine("Monad Detected");
     argFSM = ArgFSM.COMPLETE;
     currentInst.op = Instruction.MapOp(context.GetText());
     currentInst.src.loc = Locations.NONE;
     currentInst.dst.loc = Locations.NONE;
 }
Esempio n. 3
0
 public void EnterTriad(GBASMParser.TriadContext context)
 {
     PrintLine("Triad Detected");
     argFSM = ArgFSM.SRC;
     currentInst.op = Instruction.MapOp(context.GetText());
 }
Esempio n. 4
0
        public List<Byte> Assemble()
        {
            rom = new List<byte>();
            lines = new List<String>();
            byteLines = new List<String>();
            lineToByteIndex = new Dictionary<int, List<int>>();
            byteToLineIndex = new Dictionary<int, int>();
            lexer = new GBASMLexer(inputStream);
            tokenStream = new CommonTokenStream(lexer);
            parser = new GBASMParser(tokenStream);
            argFSM = ArgFSM.COMPLETE;
            db_stack = 0;
            isSectionArg = false;
            isReptArg = false;
            rep_stack = new Stack<RepInfo>();
            sec_stack = new Stack<SectionInfo>();
            jumpAddressIndex = new Dictionary<string,int>();
            unProcessedJumpLabels = new Dictionary<string, List<LabelInfo>>(); ;
            parser.BuildParseTree = true;
            Antlr4.Runtime.Tree.IParseTree tree = parser.eval();
            Antlr4.Runtime.Tree.ParseTreeWalker.Default.Walk(this, tree);

            if (AssemblyComplete != null)
            {
                AssemblyComplete(rom);
            }
            return rom;
        }