# Copyright (C) Mohammad Hasanzadeh Mofrad - All Rights Reserved # Course: CS 2210 - Compiler Design (Spring 2016) # Project: Mini Java - part 1 - Lexical Analyzer # File: Readme # Author: Mohammad Hasanzadeh Mofrad # Email: hasanzadeh@cs.pitt.edu # Date: January 2016; Last revision 01-28-2016 ## Project structure This project consists of four key files: * Makefile that build the program * lexer.l that contains the followings: - Regular expressions - String table which stores identifies and string constants - Error handling * driver.c that catch and print the output of lexer.l. * tokens.h that contains the token numbers of reserved words ## Lexer specifications The lexer consist of a set of regular expressions for detecting the following token types: * Identifies * Integer constants * String constants * Reserved words * Escape sequence characters: "\n", "\t", "\'", "\\" * Comments ## Error handling * yyerror method handles the following errors: * Malformed identifier * Malformed integer constants * Malformed string constant * Malformed comments * Unsupported characters ## Optimizations * Design to work with yytext, yylegn, yyline, yycolumnno, yylval, and yyin global variables * String table (yystrtbl method) stores the identifiers and string constant values and separates them by using '\0' delimiter * String table returns the same yylval for similar tokens * Type table stores the type of stored tokens * Remove spaces from left and right hand sides of a string constant * Allow null string constant * Allow empty string constant * No third part library is used