Main-Class: Main
% jar cmf mainClass.txt lastname-MJC.jar *.class *.java */*.class */*.java */*/*.class */*/*.java */*/*.dat
% java -jar lastname-MJC.jar infile.java
See Appendix A from Patterson and Hennessy book, written by Jim Larus for more info about MIPS.
Here is how you create a graphic on the CS department machines:
% dot -Tpng -otest.png test.dot
% dot -Tps2 -Gsize=64,64 -Gmargin=0 -otest.ps2 test.dot
% ps2pdf test.ps2 test.pdf
Here are some notes for using dot on a PC, courtesy of Eric Eastman.
These notes are from 2006 so any updates would be welcome.
After getting tired of transferring my ".dot" files from my Windows XP
system where I am doing my Java work for the class, to one of the CS
department's Linux systems to display them, I finally got the Graphviz
package to run on my XP system. Using the "dotty" viewer that comes with
the Graphviz package I can now display the graphs under XP.
I downloaded Graphviz from:
http://graphviz.org/Download_windows.php
I tried using the self-installing graphviz-2.8.exe file from this site and
had problems with it, so after de-installing it, I downloaded the
graphviz-win-2.8.bin.tgz file. This file has to be un-gzip, un-tar, and the
directories hand installed, but the dot and dotty programs work under XP.
To display the graph of the file expr2.ast.dot that Michelle sent out last
week, I used the command:
dotty expr2.ast.dot
You can create a jpg file of the graph with the command:
dot -Tjpg expr2.ast.dot > expr2.ast.jpg
I also downloaded and installed "Tintfu", a Java based Editor/Viewer for
".dot" files which works with the Graphvis package and allows you to edit
drawings, from:
http://tintfu.sourceforge.net/
It comes as a single "jar" file, so it's easy to install.
% eclipse.sh
- Window->Preferences
- Find Java->Code Style->Formatter
- Click on Edit...
- Under the Indentation tab select "Spaces only" as your Tab policy
// Make sure to replace $HOMEDIR with your own unix home directory.
// For example, /s/parsons/c/fac/mstrout
// Replace $MACHINE with a CS unix machine that you use often.
// Replace $USER with your username.
% cd $HOMEDIR
% mkdir SVNRepositories
% mkdir SVNRepositories/CS553_Projects
// create the repository on a CS unix machine
// NOTE: Each project will have its own repository.
// All the project repositories for CS553 will be in
// $HOMEDIR/SVNRepositories/CS553_Projects/.
% svnadmin create $HOMEDIR/SVNRepositories/CS553_Projects/ProjName
// upack the tarball
% tar xzf MJStart.tgz
// importing ProjName into the repository
// NOTE that the ProjName and MJStart directory do NOT have to be the same.
% cd MJStart
% setenv SVN_SSH 'ssh -l $USER'
// if you are using bash do the following:
% export SVN_SSH='ssh -l $USER'
% svn import . svn+ssh://$MACHINE.cs.colostate.edu/$HOMEDIR/SVNRepositories/CS553_Projects/ProjName -m "Initial import"
$USER@$MACHINE.cs.colostate.edu's password:
Adding ...
...
Committed revision 1.
// Make sure you are no longer in MJStart
% cd ..
// You can move the following into your .cshrc or other startup script.
% setenv SVN_SSH 'ssh -l $USER'
// if you are using bash do the following:
% export SVN_SSH='ssh -l $USER'
// for some reason the below command requires your password three times
% svn co svn+ssh://$MACHINE.cs.colostate.edu/$HOMEDIR/SVNRepositories/CS553_Projects/ProjName/ ProjName
% cd ~cs553/cs553x % mkdir SVNRepositories % svnadmin create ~cs553/cs553x/SVNRepositories/Project2 // check the permissions, the cs553x, SVNRepositories, and Project2 // directories should all have group rws permissions % ls -al % ls -al SVNRepositories/ // if they don't them change the permissions % cd SVNRepositories % chgrp -R cs553x . % chmod g+rwxs . % find . -type f -print | xargs chmod g+rw % find . -type d -print | xargs chmod g+rwxs
File-->New Project-->SVN-->Project from SVN
Specify svn+ssh://$MACHINE.cs.colostate.edu/$HOMEDIR/SVNRepositories/CS553_Projects/ProjName/
Use the wizard to set up a Java Project and select "Create New Project in Workspace" and provide a project name.
Now you can use the subversion functionality made available via the "Team" menu item, which is visible upon a right click to a project or file.
See http://www.ibm.com/developerworks/opensource/library/os-ecl-subversion/ for a tutorial on using subversion with eclipse.
java -jar java-cup-11a.jar -dump calc.cup >& parser.dump
lexer = new Yylex(System.in);
and then have the following code:
// print out all of the tokens for the file
java_cup.runtime.Symbol token = lexer.next_token();
while (token.sym != sym.EOF) {
System.out.println(token.toString());
token = lexer.next_token();
}
System.exit(0);
Follow the instructions as before in the README to build and run the example and then notice that you can see what tokens the lexer is returning because they are printed as #1, #3, etc. and you can look up what token that is in the parser.dump file.