CS 430
Notes -
Discussion:
Homework Page 171
6c)
A = A * ( B + ( C ) )
<assign> => <id>
= <expr>
=> A = <expr>
=> A
= <id> * <expr>
=> A
= A * <expr>
=> A
= A * ( <expr> )
=> A
= A * ( <id> + <expr> )
=> A
= A * ( B + <expr> )
=> A
= A * ( B + ( <expr> ) )
=> A
= A * ( B + ( <id> ) )
=> A
= A * ( B + ( C ) )
Core Notes
- Core Programs don’t have names.
- Key words are all lowercase (i.e. program, begin, end, etc.)
- It doesn’t say that you have to declare all
variables.
- Assignment statements have to be followed by an
expression, and followed by a ;
- Expressions in the Comparison must include
parentheses
- Use := for
assignments as opposed to =
- No mixed Case
Fortran
Notes
- Subprograms precede or follow the main code
-
Pascal Notes
- There is a README file that says, at the prompt use c:>
ppc386 filename.pp or c:> ppc386 filename.pas
- Every Pascal program starts with the reserve word
program
- Every Pascal program then follows with a name
(<identifier>)
NOTE: Some compilers will only
differentiate identifiers in the first 8 characters
- If it takes in any input or output you need the
reserved words input and output
- You must have a begin and end. (note period is included)
- Programs should follow the following format:
program <identifier>
(input, output);
begin
end.
- Comments can go anywhere using (* enter comment *) but may or may not span multiple lines; DON’T span multiple lines using
Pascal
- If you define a type and a variable in the
programs, define type first then var
- Declare variables as, var
<identifier-list> : <type>;
Homework:
problem 9 on page 245
problem 10 on page 246
re-read
the chapter along with the slides for chapter 5