Esempio n. 1
0
        /// <summary>
        /// Constructor: creates a new compilation engine with the given input and output. The next routine called must be compileClass().
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="outputFile"></param>
        public CompilationEngine(string inputFile, string outputFile)
        {
            //1. call Tokenizer

            _xmlTokens = new StringBuilder();
            _tokenizer = new JackTokenizer(inputFile);

            //WriteXml("<tokens>"); //<tokens>

            //first check for class element

            _tokenizer.Advance();

            if (_tokenizer.TokenType == Enums.Enumerations.TokenType.KEYWORD && _tokenizer.KeyWord() == "class")
            {
                CompileClass();
            }
            else
            {
                //error: no class struct
                _tokenizer.RecordError("expecting class struct");
            }


            //WriteXml("</tokens>"); //</tokens>

            string xml = _xmlTokens.ToString();

            Xml = xml;
        }
        /// <summary>
        /// Constructor: creates a new compilation engine with the given input and output. The next routine called must be compileClass().
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="outputFile"></param>
        public CompilationEngine(string inputFile, string outputFile)
        {
            //1. call Tokenizer

            _xmlTokens = new StringBuilder();
            _tokenizer = new JackTokenizer(inputFile);

            //WriteXml("<tokens>"); //<tokens>

            //first check for class element

            _tokenizer.Advance();

            if (_tokenizer.TokenType == Enums.Enumerations.TokenType.KEYWORD && _tokenizer.KeyWord() == "class")
            {
                CompileClass();
            }
            else
            {
                //error: no class struct
                _tokenizer.RecordError("expecting class struct");
            }

            //WriteXml("</tokens>"); //</tokens>

            string xml = _xmlTokens.ToString();

            Xml = xml;
        }
Esempio n. 3
0
 public JackAnalyzer()
 {
     var tokenizer = new JackTokenizer("asdf");
 }
Esempio n. 4
0
 public JackAnalyzer()
 {
     var tokenizer = new JackTokenizer("asdf");
 }