teaching machines

CS 330 Lecture 7 – Finishing SLOWGO, a first Makefile, and a calculator

Agenda smart compilation with Make add drawing in to SLOWGO Code makefile ANTLRWORKS = $(HOME)/bin/antlrworks-1.4.3.jar SLOWGOInterpreter.class: SLOWGOInterpreter.java SLOWGOLexer.class SLOWGOParser.class javac -cp $(ANTLRWORKS):. SLOWGOInterpreter.java SLOWGOLexer.class: SLOWGOLexer.java javac -cp $(ANTLRWORKS) SLOWGOLexer.java SLOWGOParser.class: SLOWGOParser.java javac -cp $(ANTLRWORKS) SLOWGOParser.java SLOWGOLexer.java SLOWGOParser.java: SLOWGO.g java -cp $(ANTLRWORKS) org.antlr.Tool SLOWGO.g clean: rm -f *.class SLOWGO.g grammar SLOWGO; @members { private int x […]

CS 145 Lecture 4 – String problems and our first method

Agenda extracting names: “LASTNAME, FIRSTNAME MIDDLENAME …” lock the web: does a URL end in .edu? separate a comma-separated list turn “1,234,567” into 1234567 abstraction: hiding details abstracting SVG Code NameFixerUpper.java package preexam1; public class NameFixerUpper { public static void main(String[] args) { String name = “STEINMEYER, JOEL EDWARD”; // names in bad order! // […]

CS 145 Preassignment 1 – due before Saturday, February 11

See the PDF.

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

1 208 209 210 211 212 232