Table of Contents
define-structure
doesn't actually create any dogs,
it just creates constructor, accessor, and prediates for the dog type.
<regent> := (general aide) where general is a <knight>, and aide is a <serf>. <knight> := (private salary) | (officer fellow squire servant salary) where fellow is a <knight>, and squire and servant are <serf>s. salary is a number of potatoes. <serf> := (simpleton potatoes) | (idiot) | (spy potatoes rebel) where potatoes is a number, and rebel is a <regent>.
define
to give them names for later testing.)
serf-spy
, and then test your code.
First, create a text file containing the source code; the file needs to end with the ".java" suffix.
Running a Java program is a two-step process. First you must translate--compile--the program text to a format more readily understood. The program javac (``Java compiler'') takes a .java file, and creates ``byte code'' files, with suffix .class, for each class. Then, to run the procedure main for a particular class Foo, you say java Foo.
An example is worth a thousand words:
owl% cd ~/comp210 owl% mkdir lab05 owl% cd lab05 owl% cp ~comp210/Labs/lab05/*.java . owl% ls owl% javac List.java owl% ls owl% javac Main.java owl% ls owl% java Main
Once emacs is started, select the a built-in tutorial file via the ``Help'' menu. It's one of those things you can dabble at; we'll let you do this on your own time. In the long run you'll find the control-keys more useful for moving around than the arrow keys.
keystroke | meaning |
---|---|
C-b | go backward a character |
C-f | go forward a character |
M-b | go backward a word |
M-f | go forward a word |
C-a | go to the start of the line |
C-e | go to the end of the line |
C-p | go to previous line |
C-n | go to next line |
C-v | go down one screen |
M-v | go up one screen |
C-d | delete next character |
C-k | kill (cut) from cursor to end of line |
C-y | yank (paste) back the most recently-killed text |
C-_ | undo |