Пример #1
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
            {

            }
        }
Пример #2
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;
 }