Sun Microsystems NetBeans programming environment, online manuals and help will be installed in Engineering II Building computer labs.
Essential software includes:
The /bin directory for JDK needs to be added to the PATH, and the share needs to be added to the CLASSPATH. Since the systems people intend on moving to mandatory profiles, this will be included in the profile for all CS majors.
The tools are used with the command line. The commands:
java java_cup/Main < [input]
java JLex/Main [input]
are used to access the corresponding tools.
This class will require plenty of programming in Java; I hope most of you worked in Java before. For those who have never encountered Java, Norman Matloff's A Quick, Painless Introduction to the Java Programming Language is not a bad place to start. If need be, I can dedicate a lab and/or some extra out-of-lab time to bring everyone to the same page. Java is not a difficult language to learn, and the subset of Java that is necessary to do well in this class is largely similar to C++, albeit easier to comprehend at first and more intuitive. In my oppinion, of course.
- Know your tools (JDK, NetBeans, CUP, JFlex)
Try out NetBeans, the IDE of choice for this class. Open the Sample Project, the Anagram Game. Examine the classes, fields, methods, etc. Build the project and run it. To check out how to start a new project, click on the Quick Start Quide, and follow instructions for the General Application.
Two other tools that will be used in this class are JFlex, a lexical analyzer (aka lexer, aka scanner) generator written in Java, and CUP, a parser generator written in Java. At this point it is too early to give elaborate demonstrations of the two progrmas, but do browse through their home pages and their manuals.
Very useful link to have in your bookmarks is Sun's Java Documentation web page. If you are using it very often (and I predict that you will), you might find it convenient to download it localy onto the machine you will be working on. A work of caution though: last time I downloaded it, once uncompressed it was about 200Mb big.
All packages needed for the labs will be installed in the computer labs; however, if you wish to install it on your home machines or laptops, here are the links to the downloads:
The software has been installed under Linux. Paths are provided below
because there are now two versions of java on the systems (the older one
can't be removed as there are dependencies on it).
Java compiler (javac) and other executables are in the following directory:
NetBeans IDE is in the following directory:
The .jar file for CUP is in:
The package directory for jflex is:
Java Documentation has been installed to:
- Regular Expressions
- In depth discussion of Assignment 2.
- Replace the identifier definition inside the
MiniJava.fjlex skeleton file from
Assignment 2 with regular expressions
according to the identifier specification in the textbook.
- Modify the action of the identifier-reg-exp to return the actual identifier
- Modify the action of the integer_literal to return the actual
- Compile everything and make sure it runs correctly.
- Download the skeleton file and the scripts off from the
Assignment 3 web page.
- Edit the skeleton file to support the grammar for MiniJava
expressions. For the in-lab assignment, your rules
should be in the lines of:
program ::= exp;
exp ::= ... | ... | ... ;
(When you write the parser for the assignment, your compiler
should be written for the whole MiniJava language, not just the
- Generate the parser using CUP, compile it, and run it on
simple MiniJava programs, consisting only of expressions.
- Code and test the report_error( ... )
method, which is called by the CUP generated parser to print error
messages about syntax errors.
- No in-lab exercise this week.
- No in-lab exercise this week. Continue to work on your projects. Your attendance is marked as your
in-lab exercise grade.
- Code BuildSymbolTableVisitor's visit methods for any four of the Decl's
of MiniJava (i.e. MainClass, ClassDeclSimple, ClassDeclExtends, MethodDecl,
- Code TypeCheckVisitor's visit method for CallExp.
- Code and compile visit(NewArray n)
- Code and compile visit(NewObject n)
- Code as much of the visit(Call n) as possible