teaching machines

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 […]

CS 145 Lecture 1 – Introduction, data, and arithmetic operators

Agenda introduction our class: prior programming experience majors communication math two fronts: data and instructions arithmetic operators variables data: ints and doubles instructions: System.out.println, + – * / % = Code Mathiness.java package preexam1; public class Mathiness { public static void main(String[] args) { System.out.println(26.16 * 0.15); System.out.println(1000000.0 / 540000.0); System.out.println(); System.out.println(57 % 12); double […]

CS 330 Lecture 2 – Regular expressions

Agenda Activate your Piazza account! Adventure, Zork Imperative languages Scripting languages Perl Scripting languages John Ousterhout once said: Scripting languages are designed for different tasks than are system programming languages, and this leads to fundamental differences in the languages. System programming languages were designed for building data structures and algorithms from scratch, starting from the […]

CS 330 Homework 1 – due before Friday, February 3

See the PDF.

CS 330 Final Project

See the PDF.

CS 330 Lecture 1 – Introduction, DFAs

Agenda build a language-recognizing machine DFAs: set of states (one starting, one or more accepting) input alphabet transition function, mapping state and current symbol to next state course information you? name? what if not computers? write a short language biography build more language-recognizing machines: one- or two-digit month numbers articles of the English language (a, […]

1 2