Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {

                CPicCodeGenerator Code = new CPicCodeGenerator("Jason.HEX");
                CP16F84ByteOperations Instructions = new CP16F84ByteOperations();
                CP16F84ControlOperations Control = new CP16F84ControlOperations();
                Code.AddInstruction( Control.MovLW(5)     );
               // Code.AddInstruction( Instructions.MovWF(0x0C) );
               // Code.AddInstruction( Control.MovLW(5)     );
               // Code.AddInstruction( Instructions.SubWF(TRegisters.WORKING_REGISTER, 0x0C) );
               // Code.AddInstruction( Instructions.MovWF(0x0D));

                Code.GenerateHexFile();
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
        public CCompiler(String SourceFile, String Keywords, String SpecialRegisters, PIC_PROCESSOR microp)
        {
            try
            {
                String HexFile = SourceFile.Substring(0, SourceFile.Length - 5);
                HexFile += ".hex";
                m_LexScanner = new CLexScanner(SourceFile, Keywords);
                m_SymbolTbl = new CSymbolTable(SpecialRegisters);
                m_CodeGenerator = new CPicCodeGenerator(HexFile);
                m_MachineCodeOps = new CMachineCodes(microp);
                m_Parser = new CParser(m_LexScanner, m_SymbolTbl, m_MachineCodeOps, m_CodeGenerator);
            }
            catch (Exception)
            {
                throw new CCompilerException("Error initialising the compiler", TErrorCodes.COMPILER_ERROR);
            }
            finally
            {

            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Modified: [10/01/07] The constructor now accepts the symbol table
 /// as a parameter. The Symbol table is initialised by the CCompiler 
 /// object and populated by the CParser obejct.
 /// </summary>
 /// <param name="LexicalScanner">The lexical scanner that scans the JasC source file.</param>
 /// <param name="SymTbl">Symbol table used to store variable and function information.</param>
 public CParser(CLexScanner LexicalScanner, CSymbolTable SymTbl, CMachineCodes MachineCodeOps, CPicCodeGenerator CGen)
 {
     m_LexScanner = LexicalScanner;
     m_SymbolTable = SymTbl;
     m_CodeGen = CGen;
     m_MachineCodeOps = MachineCodeOps;
 }