,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 6
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,,
,ft

,ce 1
4-##
,,
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)

,ce
IDENTIFIERS

Identifiers are used to name programs, constants, types, variables, procedures, and functions. Some identifiers are predeclared by the compiler but can be redefined by the user. Other identifiers are predeclared and cannot be redefined by the user, these are called reserved words. An identifier is a sequence of letters, digits, and underscores (_) with the following restrictions :

* The identifier must begin with a letter
* The identifier must not contain any blanks
* The identifier must not cross a line boundary

OmegaSoft Pascal allows identifiers to be up to 80 characters, and all characters are significant. Note that identifiers that must pass between modules (entry, external, etc.) are only significant to the first 8 characters. THe following are examples of valid and invalid identifiers :

   VALID                        INVALID

   test1                        _test1    {starts with _}
   test200                      200test   {starts with a digit}
   time_of_day                  time&day  {contains an ampersand}

,ce
PREDECLARED IDENTIFIERS

OmegaSoft Pascal predeclares the following identifiers :

abs             addr            append          arccos
arcsin          arctan          at              auxout
boolean         break           byte            char
chr             cline           close           concat
conversion      cos             create          data
del             deverr          device          devinit
devstat         dispose         e               entry
enum            eof             eoln            exit
exp             external        false           firq
floor           forward         get             halt
hex             index           input           integer
interactive     interrupt       keyboard        length          
ln              log             longhex         longinteger     
mark            maxint          maxlint         memavail
minint          minlint         modend          module
new             odd             open            ord
otherwise       output          page            pcr
pi              pred            put             random
range           read            readln          real
release         register        reset           rewrite
round           seek            sin             sizeof
sqr             sqrt            string          substr
succ            tan             task            text
true            trunc           update          upshift
varib           write           writeln
,pg
,ce
PREDECLARED IDENTIFIERS

These predeclared identifiers may be redefined to denote some other item. Doing so will mean that you will not be able to use the identifier for its intended purpose and therefore it is recommended that you not redefine standard identifiers.

The standard I/O device names : input, output, auxout, and keyboard are considered global if they are declared in the program.

,ce
RESERVED WORDS

Reserved words are predeclared identifiers that may not be redefined at any time and include :

and             array           begin           case
const           div             do              downto
else            end             eor             file
for             function        goto            if
in              label           mod             nil
not             of              or              packed
procedure       program         record          repeat
set             then            to              type
var             until           while           with

,ce
SPECIAL SYMBOLS

OmegaSoft Pascal includes the following special symbols :

Symbol    Usage                                        

 space    delimiter
  !       inline assembly code marker
  #       character constant marker
  $       hex constant marker
  %       binary constant marker
  '       character and string constant delimiter
  (       start of parameter list or expression
  )       end of parameter list or expression
  *       arithmetic multiply and set intersection
  **      power operator
  +       arithmetic addition and set union
  ,       list separator
  -       arithmetic subtraction or set difference
  .       end of program or decimal point
  ..      subrange
  /       division
  :       part of declaration syntax and case statement
  :=      assignment
  ;       general syntax separator
  <       less than or direct page addressing (following "at")
  <<      shift left
  =       equal to
  >       greater than
  >>      shift right
  <=      less than or equal to
  >=      greater than or equal to
  <>      not equal to
  [       start of array index
  ]       end of array index
  ^       pointer to or pointer dereference
  _       used in long identifiers for clarity
,ce
SPECIAL SYMBOLS

Symbol    Usage                                        
  {       start of comment
  }       end of comment
  (*      alternate symbol for {
  *)      alternate symbol for }
  (.      alternate symbol for [
  .)      alternate symbol for ]
  @       alternate symbol for ^

,ce
DELIMITERS

The semicolon (;) is used to separate one Pascal statement from another. More than one statement may appear on a line, but the statements must be separated by semicolons. Correct usage of semicolons tends to be the most common problem that new Pascal programmers have. It is unfortunate that Wirth made the semicolon a statement separator rather than a statement terminator. This methodology also applies to the use of the semicolon as a separator in declaration sections.

One way many Pascal programmers get away with poor use of semicolons is that a semicolon may be used immediately before the "end" in a compound statement or case statement. A semicolon in this position results in a "null" statement and is generally harmless.

The period (.) delimits the end of a Pascal program.

Spaces and carriage-returns are separators and cannot appear in an identifier, any number, or special symbol. At least one separator must be used between consecutive identifiers, reserved words, and numbers. This allows a great deal of freedom in the formatting, for an example see the next section on program documentation.

Begin and end are reserved words that act as delimiters. Begin indicates the start of a compound statement and is not followed by a semicolon. End terminates a record definition, a compound statement, or a case statement.

,ce
PROGRAM DOCUMENTATION

Probably the most significant advantage Pascal has over other languages such as assembly, "C", and Forth is its inherent self-documentation. This feature results in more source code for a given amount of object code than the other languages, but pays off in reduced maintenance costs in the long run. 

Towards that end, it is recommended that your company define guidelines for program documentation and structure. The following are recommendations only and in no way are enforced by the compiler.

It is generally good practice to put a comment section before the main program and every procedure describing its purpose, parameters, and any global variables affected. It is usually not necessary to insert comments in with the code as is required by other languages.

The syntax for comments is :

comment = { characters } | (* characters *)
,ce
PROGRAM DOCUMENTATION

Comments are syntactically equal to separators. Replacing them by a blank does not alter the meaning of the program unless the comment is also a compiler control toggle (see compilation options section).

As shipped, this compiler conforms to ISO standard by not allowing comments to be nested. This may be patched by the user to allow nesting up to whatever level is desired (maximum of 65000 deep).

Since Pascal is a free format language, a great deal of freedom is provided for layout. All of the following represent the same program and will be compiled the same :

program
test
(output)
;
begin
writeln (
'test')
end.

program test (output) ; begin writeln ('test') end.

program test (output) ;
  begin
    writeln ('test')
  end.

As an aid to determining the structure of a program the compiler provides an "indent" count along with the line number on the listing. This indent count represents what level the compiler is in based on the first identifier in the line. This in no way dictates what style of layout you must use in your programs. 

The recommended indenting is based on the guidelines presented in 'Programming in PASCAL' written by Peter Grogono and published by  Addison-Wesley. The indent count starts at 0 representing the left margin and increments one per indenting level. After the count reaches 9 its next increment is A, and the count proceeds through the alphabet. If the count gets very far into the alphabet it is usually a signal that you should break something out into a procedure or function.

Const, type, var, procedure, and function headings should be indented. The bodies for the const, type, var, procedure, and function sections should be indented from their headings. 

The following layouts are recommended for statements :
 
Begin
  Statement_1 ;
  Statement_2 ;
  ...
  Statement_N
End

If expression
  then
    statement

,ce
PROGRAM DOCUMENTATION

If expression
  then
    statement
  else
    statement
 
While expression do
  statement

For X := expression_1 to expression_2 do
  statement
 
Repeat
  Statement_1 ;
  Statement_2 ;
  ...
  Statement_N
Until expression
 
With variable do
  statement

Case expression of
  Constant1 :
    statement_1 ;
  Constant2 :
    statement_2 ;
  ...
  ConstantN :
    statement N
  Else
    statement
End { case }
