Ejemplo 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;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 public JackAnalyzer()
 {
     var tokenizer = new JackTokenizer("asdf");
 }
Ejemplo n.º 4
0
 public JackAnalyzer()
 {
     var tokenizer = new JackTokenizer("asdf");
 }