CS 330 Lecture 19 – A Logo REPL Part II
Agenda what ?s comments bugs a REPL variables expressions General Test Topics Things on the exam: addressable memory stack vs. heap storage pattern matching with common regex primitives types and type checking declarations vs. definitions basic instructions (pushl, movl, addl, subl) and flow control (cmpl, jmp and friends) in assembly big picture ideas small code […]
CS 330 Lecture 18 – A Logo REPL
Agenda what ?s why write our own languages? program this building an interpreter… …with a REPL TODO Nada. Though you wish to write more exam questions and post them in the comments. The more questions you come up with, the fewer I’ll come up with. Program This Code Logo.g4 makefile Note to copy and pasters: […]
CS 330 Lecture 17 – Callbacks and Parsing with ANTLR
Agenda one more thing on C function pointers: callbacks http://www.opengl.org/resources/libraries/glut/spec3/node46.html http://www.opengl.org/resources/libraries/glut/spec3/node54.html#SECTION00089000000000000000 program this the translation process: lexing, parsing, generating ANTLR v4 why write our own languages and parsers? TODO Read chapter 2 through section 2.1. Walk through http://www.antlr.org/wiki/display/ANTLR4/Getting+Started+with+ANTLR+v4. Quarter sheet. Program This Code torus.c Divs.g4 messy.txt PrettyPrinter.java Haiku
CS 330 Lecture 16 – Polymorphism in C, Higher-order Functions
Agenda what ?s answer this! polymorphism in C through unions higher-order functions in C TODO Rest. Answer This! Code makefile Note to copy and pasters: makefile rules need to be indented with real tabs, not spaces. stack.h stack.c names.c sorters.c Haiku
CS 330 Lecture 15 – Makefiles, For Real
Agenda what ?s the need for separate compilation the way to manage separate compilation: make polymorphism in C: unions TODO Write a midterm exam question on something you read or something discussed in lecture. Turn it in on a quarter sheet. Some portion of the upcoming midterm will be comprised of your questions. In addition […]
CS 330 Lecture 14 – Postfix Calculator and Make
Agenda what ?s hw2 grading script ready and untested program this! making stack reusable managing compilation with make TODO Read section 8.3 in your book. Quarter sheet. On the valgrind logo: http://valgrind.org/gallery/artwork.html. Program This Code strappend.c stack.c stack.h stack_user.c Haiku
CS 330 Lecture 13 – Data Structures in C, Make
Agenda what ?s riddle variable-length arrays distinct ideas: memory is addressable heap memory can be allocated dynamically generating stereo tones pointer arithmetic a stack data structure without classes typedef separate compilation and header files a postfix calculator managing separate compile with make Variable-length Arrays The C99 standard allows arrays whose sizes are only known at […]
CS 330 Lecture 12 – Malloc, Classless Data Structures, and Make
Agenda what ?s what does this do? two primary reasons for heap storage: functions can return data cheaply memory needs not always known at compile time an EZMALLOC macro aplay -c 2 -f S16_LE -r 22050 file pointer arithmetic fopen, fwrite, fclose a stack API the need for separate compilation and header files makefiles What […]
CS 330 Lecture 11 – Call by *, Addresses, Malloc
Agenda what ?s call by value call by reference dereferencing: turning an address into a value what pointers support cheap sharing multiple “return” values functions returning data: make_path the heap aplay -c 2 -f S16_LE -r 22050 pointer arithmetic malloc and free TODO Optionally, for the curious: http://cm.bell-labs.com/cm/cs/who/dmr/chist.html. Read sections 3.7 and 3.8. Quarter sheet. Code […]
CS 330 Lecture 10 – Enums, Structs, Call by *
Agenda C string functions strcpy strcat strlen strchr strcmp strfry Java enums encapsulation of data (only) via C structs declarations vs. definitions call by value addresses vs. values TODO Read section 7.7 in your book. Quarter sheet. Watch Pointer Fun with Binky. Code cards.c Rank.java BlackJack.java HomecookedEnumRank.java Direction.java Go.java path.c bookmarks.c Haiku