| ||
Getting Started: Command Line Interaction (cont'd) |
Taking one stepWith BETA assignment syntax, data flows from the left to the right just like we read from the left to the right. This is very unusual, but after a while you might think (like me :-) that it is the way to do it. Anyway, the syntax:
'world!' and puts it into the object s . In
many programming languages, this would look more like:
[ENTER] , giving
the response:
s :
s denotes an
object, and the state of this object is the string value
"world!" .
We can investigate information known from static analysis:
s can accept a string value in
assignments. Consequently, anything whose evalinfo is
also a string static transient can be assigned to it.
(Try "help evalinfo" .)
A constant, an expression, and a primitive
The BETA way to express a constant is to declare a pattern which
simply delivers (
s
are used in an expression whose value is "inserted into"
stdio :
stdio is the primitive entity which makes it possible to
read the standard input and write to the standard output. Again, the
arrow, "->" , signals data flow, and the values flow in
the direction of the arrow, into stdio .
If you execute this imperative:
"Hello, world!"
was delivered to the standard output), and since we reached the end of
the program, gbeta entered the terminated state.
Modern conveniences..
Often you can just press
In general, commands can be abbreviated. If an abbreviated command
matches more than one command name, the first mathing command is
executed (no warning about ambiguities!). To find out what command
matches a given abbreviation, e.g.
n abbreviates the command
next , and it gives some general information about the
next command as well.
This is best for one-file programsAt the command line, gbeta can only pretty-print the enclosing source code to show you what part of the program is currently being executed. Since pretty-printing drops all comments and reshapes the source code formatting to a strictly regular style, lots of information is lost, and this approach gets tedious and confusing when running any but the smallest programs interactively. The next section presents the integration of gbeta with GNU Emacs which gives a much more useful environment for larger programs. |