CS 330 Homework 2 – due before Monday, February 13
See the PDF.
CS 330 Lecture 6 – Lexing, parsing, and translating
Agenda lexing recursive descent parsing writing interpreter glue adding state to ANTLR adding actions in ANTLR Code SLOWGO.g grammar SLOWGO; @members { private int x = 0; private int y = 0; private int theta = 0; private boolean isDrawing = false; } program @init { System.out.println(“axis equal”); System.out.println(“hold on”); } : command+ ; command […]
CS 145 Lecture 3 – Algorithms
Agenda algorithm pseudocode program this an early algorithm, a la Euclid primitives have operators objects have methods API String methods Program this You are indecisive. So are your friends. One quiet Monday night, you all decide one night to come up with a list of restaurants, each accompanied by a probability of how often you […]
CS 330 Lecture 5 – Our first language
Agenda your Logo their Logo our Logo hi, ANTLR recursive descent parsing Your Logo Design with a partner a little language that lets you move around in 2-D and draw things. Write down: your instructions an example program Their Logo From Papert’s NSF grant: The word constructionism is a mnemonic for two aspects of the […]
CS 145 Lab 3 – Using objects
Prelab Complete Self-check 3.14 on the Practice-It website before 8 AM on February 6. Introduction Our variables aren’t just simple numbers anymore. We’ve got complex objects like String and Scanner at our disposal. Today we’ll get more practice at using objects that others have made available. Reminder: Be sure to get your checkpoints from lab […]
CS 330 Lecture 4 – Regex to NFA to DFA to fail
Agenda how to implement a regex engine what’s an NFA? converting a regex to an NFA converting an NFA to a DFA the limits of DFA-recognized languages the pumping lemma context-free grammars balancing parentheses a calculator language parse tree Regex to NFA concatenation alternation Kleene star NFA to DFA DFA’s start state is set of […]
CS 145 Lab 2
This lab builds on your readings and lecture discussion of variables and arithmetic operators. We’ll also see two new types, Scanner and String. Before you get started: Load the workspace you made last lab. It should be H:\workspace drive — not on C:. Make a new package named lab2 in your cs145 project. Plea The […]
CS 145 Lecture 2 – More data, more instructions
Agenda what does this do? literals vs. variables a few more types (int, char, boolean) penny RAM a few more instructions (cos, pow) Javadoc String What does this do? Code Day2.java package preexam1; public class Day2 { public static void main(String[] args) { double myNum = 6.7; int brettsFavoriteNumber = 9; char debrasFavoriteLetter = ‘d’; […]
CS 330 Lecture 3 – Regular expressions++
Agenda more wildcard characters developing on clark.cs.uwec.edu substitution slurping a file expressions as replacements Perl subroutines zero-width assertions Code emails.pl #!/usr/bin/perl open($in, ‘<‘, ‘getlist.txt’); while ($line = <$in>) { $line =~ s/^(\S+).*$/$1\@uwec.edu/; print($line); } close($in); page.html <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <title></title> </head> <body> <h2>Foo</h2> <h3>Blech</h3> <h4>Scrumpt</h4> </body> </html> demote.pl […]