Class Common
Week 16
Week 15
Code Generation example: while loop
- test_while_loop.csl
- lexer.g
- parser.g
- code generation
Code Generation:
- TestCodeGen: code generation driver class
- CodeGen: entry point of codegen module
- IRNode and other code gen classes
- XMLTreeView: JDOM tree visualization
Front-End:
- lexer.g
- simplified parser.g
- full parser.g
Week 14
- CSLite sample compiler tutorial
- JDOM XML tree package tutorial
- Chirp-Scribbler Lite Sample Compiler in Eclipse project:
download project .zip file
Week 12
File I/O
- FileCopy Class
Expression classes
- Expression class
- Constant class
- AddExp class
- SubExp class
- MulExp class
- DivExp class
- TestExp class
Week 11
- Lab Tutorial 2: Scribbler Programming
- Read BASIC Stamp Manual v2.1.pdf p79-98 to understand BASIC Stamp memory and variables. Answer the following questions:
- What's the maximum number of word-sized variables that can be defined in Scribbler?
- What's the difference between ROM and RAM data/variables?
- How to define variables of word, byte, nib, bit type?
- What is pin variable and how do you use it? use LED pin to experiment.
- Experiment with arithmetic expression evaluation using variables, use DEBUG commands to read input and print output through Stamp Editor console.
- Read What's a Microcontroller v2.2.pdf Ch2, write PBASIC commands to turn on/off LEDs, find out proper LED pins.
- Read Ch7 Light Measurement, write PBASIC commands to read and print light sensor value. Block the sensor and find out how the light data will change.
- Read Ch8 Frequency and Sound, understand how to set frequency and play note on Scribbler speaker. Run the TwinkleTwinkle.bs2 program on p232 on Scribbler.
- Lab Tutorial 1
- Read the Scribbler Start-Up Guide v1.0.pdf in ~cs204/scribbler/scribbler_cd/Resources/ (the cs204 account web page) to understand scribbler hardware features
- Login to 314 lab PC and run Scribbler GUI Maker and Stamp Editor.
- Connect Scribbler robot with USB cable to PC, run StampEditor, use the Identify command (push ID button on tool bar) to verify robot-PC connection.
- Use Scribbler GUI Maker to reset Scribbler to default demo program: exit any open StampEditor to avoid conflict, push the restore-to-demo button on toolbar. Popup message should report upload successful.
- Disconnect the cable, test the demo program as described in Scribbler Start-Up Guide v1.0.pdf. The code pattern is summarized on the Scribbler Wiki.
- Use Scribbler GUI Maker to build simple program to control scribbler, eg, turn on/off LEDs, play music notes. Upload your program to Scribbler. Push the open StampEditor toolbar button to view the generated PBASIC code. Read and understand the generated code.
- Connect Scribbler to PC, read What's a Microcontroller v2.2.pdf p20-p27, run the "Hello Wolrd" example using StampEditor.
- Read and understand the overall structure of the Default Demo Program
Week 10
http://java.sun.com/javase/6/docs/api/java/util/package-summary.html
- java.util.Collections class:
http://java.sun.com/javase/6/docs/api/java/util/Collections.html
Week 9
Week 8
Week 6
Stack Adaptor
Week 5
MovieMgr:
FindMin Visitor:
Sum Visitor:
Test class for FindMin and Sum:
Visitor Pattern:
- AList
- Visitor interface
- EmptyAList
- NEList
- Length visitor
- Test class
FindMin method:
Week 4
Sum Example:
Singleton Pattern:
Week 3
Week 2
Week 1
- Hello world in Java
- Using DrJava from command line:
- download drjava.jar and put it on your CLASSPATH
- type: java edu.rice.cs.drjava.DrJava
- Using printf
- System.out.printf("hello, %s\n", world);
- Using classes from the Media Java book
- download mediabook.jar
- edit DrJava preference->Resource Location, add mediabook.jar to the Extra Classpath
- now try the following in the DrJava interactions panel:
> World w = new World();
> Turtle t = new Turtle(w);
> t.forward(100);
>