compiler-course-pa2
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Coursera Programming Assignment 2
README file for Programming Assignment 3 (Java edition)
=======================================================

Your directory should now contain the following files:

 Makefile		  -> [course dir]/src/PA3J/Makefile
 README
 cool.cup
 bad.cl
 good.cl
 cool-tree.java		  -> [course dir]/src/PA3J/cool-tree.java
 cool-tree.aps		  -> [course dir]/src/PA3J/cool-tree.aps
 AbstractSymbol.java	  -> [course dir]/src/PA3J/AbstractSymbol.java
 AbstractTable.java	  -> [course dir]/src/PA3J/AbstractTable.java
 BoolConst.java		  -> [course dir]/src/PA3J/BoolConst.java
 CgenClassTable.java	  -> [course dir]/src/PA3J/CgenClassTable.java
 CgenNode.java		  -> [course dir]/src/PA3J/CgenNode.java
 CgenSupport.java	  -> [course dir]/src/PA3J/CgenSupport.java
 ClassTable.java	  -> [course dir]/src/PA3J/ClassTable.java
 CoolParser.java	  -> [course dir]/src/PA3J/CoolParser.java
 CoolTokenLexer.java	  -> [course dir]/src/PA3J/CoolTokenLexer.java
 Flags.java		  -> [course dir]/src/PA3J/Flags.java
 IdSymbol.java		  -> [course dir]/src/PA3J/IdSymbol.java
 IdTable.java		  -> [course dir]/src/PA3J/IdTable.java
 IntSymbol.java		  -> [course dir]/src/PA3J/IntSymbol.java
 IntTable.java		  -> [course dir]/src/PA3J/IntTable.java
 ListNode.java		  -> [course dir]/src/PA3J/ListNode.java
 Parser.java		  -> [course dir]/src/PA3J/Parser.java
 StringSymbol.java	  -> [course dir]/src/PA3J/StringSymbol.java
 StringTable.java	  -> [course dir]/src/PA3J/StringTable.java
 SymbolTable.java	  -> [course dir]/src/PA3J/SymbolTable.java
 TokenConstants.java	  -> [course dir]/src/PA3J/TokenConstants.java
 TreeConstants.java	  -> [course dir]/src/PA3J/TreeConstants.java
 TreeNode.java		  -> [course dir]/src/PA3J/TreeNode.java
 Utilities.java		  -> [course dir]/src/PA3J/Utilities.java
 *.java			  other generated files

	The Makefile contains targets for compiling and running your
	program. DO NOT MODIFY.
    
	cool.cup is the skeleton for the parser specification that you
	are to write. It already contains productions for the program
	and the classes. Use them as an example to write the remaining
	productions.  You should also read the CUP documentation.
	This skeleton will compile and run as is, but it doesn't
	do much.

	good.cl, bad.cl test a few features of the grammar. You should
	add tests to ensure that good.cl exercises every legal
	construction of the grammar and that bad.cl exercises as many
	different parsing errors as you can squeeze into one file.

	cool-tree.aps contains the definitions for the tree language
	which you use to construct the abstract syntax tree (AST).  From
	this file, cool-tree.java is automatically generated by a
	utility that compiles the specification into Java classes for
	constructing tree nodes.  This file is provided for your
	reference.  DO NOT MODIFY.

        TreeNode.java and ListNode.java contain definitions used by the
        tree package. DO NOT MODIFY.  

        Parser.java contains a driver to test the parser. DO NOT MODIFY.

	Flags.java implements routines for parsing command line
	flags. DO NOT MODIFY.

        The rest of the files are created as byproducts of `CUP', or
        are internal parser support files.  DO NOT MODIFY.
        `CoolParser.java' is the generated Java file containing the
        parser.  DO NOT MODIFY this file directly; instead, edit
        cool.cup and this file will be regenerated automatically.

	Files not discussed are covered in the README for PA2J.

Instructions
------------

	To compile your parser program type:

	% make parser

	This compiles all the classes and produces an shell script named
	"parser" which invokes Parser.main() as the standalone phase of
	the Cool compiler.  It requires lexer, semant, and cgen to do
	anything useful.

	To test your parser on a file 'foo.cl' type

	% myparser foo.cl

	myparser is a shell script that "glues" together lexer and
	parser using pipes.  Don't worry if the line numbers you get by
	running Java version of the parser are slightly off as compared
	to the "official" parser.

	To run your parser on the files good.cl and bad.cl type:

	% make dotest

	To run the (provided) lexer and your parser on a file called test.cl type:

	% ./lexer test.cl | ./parser

	If you think your parser is correct and behaves like
	the one we wrote, you may want to run a COOL compiler using
	your parser:

	% mycoolc foo.cl

	To overwrite the default lexical analyzer with yours, replace 
	lexer (which is a symbolic link to the "official" lexer) with
        your lexer from PA2.

	To turnin your work type:

	% make submit-clean

	And run the "submit" program following the instructions on the
	course web page.
	
	Running "submit" will collect the files cool.cup, good.cl, bad.cl,
	good.output, bad.output, and README. Don't forget to edit the
	README file to include your write-up, and to write your own test
	cases in good.cl and bad.cl.

 	You may turn in the assignment as many times as you like.
	However, only the last version will be retained for
	grading.

	If you change architectures you must issue

	% make clean

	when you switch from one type of machine to the other.

	GOOD LUCK!

---8<------8<------8<------8<---cut here---8<------8<------8<------8<---

Write-up for PA3J
-----------------

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。