# Copyright (C) Mohammad Hasanzadeh Mofrad - All Rights Reserved # Course: CS 2210 - Compiler Design (Spring 2016) # Project: Mini Java - part 2 - Syntax Analyser # File: Readme # Author: Mohammad Hasanzadeh Mofrad # Email: hasanzadeh@cs.pitt.edu # Date: February 2016; Last revision 02-25-2016 # Mini Java - Syntax Analyzer ## Compatible GCC version # gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ## Compatible file character encoding # text/x-c; charset=us-ascii ## Successful run on arsenic.cs.pitt.edu ## Project structure This project consists of the following key files: * Makefile that build the program * parser.y contains grammars for YACC tool * driver.c runs the parser * lexer.l contains regular expressions for LEX tool * proj2.c and proj2.h contain libraries to print syntax tree * tokens.h contains token numbers of reserved words for lexer * lexer0.c (lexical analysis only) contains regular expressions for LEX tool * driver0.c (lexical analysis only) runs the lexer ## Building the project For help building the parser: * make help For building the parser: * make parser For using the parser: * ./parser PATH_TO_TEST_FILE ## Parser specifications The parser consist of a set of grammar rules to draw the syntax tree of the mini Java rules. * Design to work with yytext, yylegn, yyline, yycolumnno, yylval, and yyin global variables * No third party library is used * Utilizing Nested levels of MakeTree and MakeLeaf for constucting the syntax tree * Enforcing precedence * Enforcing left or right associativity * Shift/reduce conflicts free * Reduce/reduce conflicts free ## Error handling yyerror method in parser.y prints the errors location including line:column.