home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / FACILIS1.ZIP / FACILIS.UM < prev    next >
Encoding:
Text File  |  1980-01-01  |  13.4 KB  |  319 lines

  1.  
  2.                          FACILIS User Manual
  3.  
  4. Version 0.30  (preliminary)                               File: FACILIS.UM
  5.                                                           Updated: 14 Jul 85
  6.  
  7.  
  8.  
  9. INTRODUCTION
  10.  
  11.    Facilis is a p-code compiler for an extended subset of the Pascal
  12. programming language.  It is based on the Pascal S compiler of Niklaus Wirth.
  13. It was adapted for the IBMPC by John R. Naleszkiewicz, and is being extended
  14. by Anthony M. Marcy.  It is in the public domain.
  15.    Facilis is written in Pascal and can be compiled by the Turbo Pascal
  16. compiler sold by Borland International.  It cannot compile itself.
  17. For details on how to compile the Facilis source code, see the implementation
  18. manual (file FACILIS.IMP).
  19.    This manual tells you how to run Facilis and describes its features and
  20. limitations.  Knowledge of standard Pascal is assumed; hence emphasis here
  21. will be on deviations from the standard.
  22.  
  23.  
  24.  
  25. CONFIGURATON REQUIREMENTS
  26.  
  27.    Hardware:   IBM PC
  28.                192K memory
  29.                1 disk drive
  30.  
  31.    Software:   PC-DOS 1.1 or later
  32.                file FACILIS.COM
  33.                file FACILIS.000
  34.  
  35.  
  36.  
  37. GETTING STARTED
  38.  
  39.    Type FACILIS at the DOS command prompt.  FACILIS.COM may be on any drive,
  40. but FACILIS.000 must be on the DOS default drive.
  41.    You will be prompted for the name of the file containing your Pascal source
  42. code.  If you enter a filename without an extension, .PAS is assumed.
  43.    Next, you will be asked to name your listing file.  The listing file will
  44. contain a numbered listing of your source code together with any error messages
  45. or diagnostic dumps.  Enter any legal filename, or a carriage return to accept
  46. the default.  DOS device names are legal, too -- CON: to list to the screen,
  47. PRN: for the printer, or NUL for no listing at all.
  48.    Alternatively, you may enter the source filename and listing filename as
  49. parameters on the DOS command line when invoking Facilis.  If you omit the
  50. listing filename, the default (the source filename with extension .LST) will
  51. be assumed without a prompt.
  52.    Your program will now be compiled.  If it compiles successfully, it will
  53. immediately be run.  If the compiler detects errors, control returns to DOS
  54. and the listing file will show you what went wrong.
  55.  
  56.  
  57.  
  58. COMPILER DIRECTIVES
  59.  
  60. A comment that has the character '$' as its first character is used to specify
  61. compiler options.  These take the form of a letter followed by a plus sign
  62. (option on) or a minus sign (option off).  All options default to off.
  63. The following options are available:
  64.  
  65.        T+ : Causes the symbol table, the generated p-code, and other internal
  66.             tables to be printed to the list file at the end of compilation.
  67.        S+ : While this directive is in effect, the run time stack is dumped
  68.             to the list file at each entry to a procedure.
  69.  
  70.  
  71.  
  72. THE SOURCE LANGUAGE
  73.  
  74.    The current version of Facilis does not support all of standard Pascal.
  75. Major features not implemented include: files, sets, subrange and enumerated
  76. types, pointers, labels and the GOTO statement, the WITH statement, and
  77. variant records.  A major extension to standard Pascal is dynamic strings.
  78.  
  79. SOURCE TEXT may be prepared with your favorite text editor.  Lines may be up
  80.    to 121 characters long, ending with a CR.  LFs, TABs, and other control
  81.    characters are treated as blanks.
  82.  
  83. COMMENTS may be delimited with either (* and *) or with { and }.  Comments may
  84.    not be nested, but one kind of comment brackets may appear within a comment
  85.    enclosed by the other kind.
  86.  
  87. IDENTIFIERS: Variable names, etc., may be any length (so long as it fits on one
  88.    line) but only the first 10 characters are significant.  The underscore
  89.    character may be used, in addition to the letters and digits.
  90.    Upper and lower case letters are equivalent.
  91.  
  92. INTEGERS range from -32768 to +32767.  Predefined constant MaxInt = 32767.
  93. REALS may have up to 11 significant digits, with an exponent in the
  94.    range -38 to +38.
  95. STRINGS may have up to 32748 characters.
  96.  
  97. PROGRAM PARAMETERS (in parentheses after the keyword PROGRAM) are optional.
  98.    If present, they are ignored.
  99.  
  100. TYPES: Integer, real, boolean, char, string, array, and record types are
  101.    supported.  File, set, subrange, enumerated, label, and pointer types are
  102.    not implemented.  Elements of arrays and records may be of any type,
  103.    including strings.  Records may not have variant fields.  PACKED arrays
  104.    and records are allowed, but the PACKED attribute has no effect.
  105.  
  106. PROCEDURES and FUNCTIONS may not be declared FORWARD, nor may they be
  107.    passed as parameters.  Declarations may be nested to a depth of 7.
  108.    All standard builtin functions are supported:
  109.        abs     atan    chr     cos     eof     eoln    exp     ln
  110.        odd     ord     pred    round   sin     sqr     sqrt    succ    trunc
  111.    String functions:
  112.        copy    length  pos     str     val     maxavail
  113.    Screen functions and procedures:
  114.        wherex  wherey  clrscr  gotoxy  textcolor  textbackground
  115.    Builtin I/O functions and procedures:
  116.        read    readln  write   writeln inkey   keypressed
  117.    Miscellaneous:
  118.        upcase  halt    delay   sound   nosound random  randomize
  119.  
  120.   Functions WHEREX and WHEREY return integer values giving the screen cursor
  121.      x and y coordinates, respectively.
  122.   Procedure CLRSCR clears the screen.
  123.   Procedure GOTOXY(x:integer; y:integer) moves the cursor to coordinates
  124.      (x,y), where (1,1) is the upper left corner and (80,25) is lower right.
  125.      Coordinates outside this range cause a runtime error.
  126.   Procedures TEXTCOLOR(n:integer) and TEXTBACKGROUND(n:integer) set the
  127.      foreground and background colors for subsequent output to the screen.
  128.   Boolean function KEYPRESSED returns True if there is a character waiting
  129.      in the keyboard buffer, False otherwise.
  130.   Char function UPCASE(c:char) converts lowercase characters to uppercase.
  131.      All other characters are left unchanged.
  132.   Procedure HALT terminates execution of the program.
  133.   Procedure DELAY(x:integer) pauses execution for x milliseconds.
  134.   Procedure SOUND(x:integer) turns on the speaker at a frequency of x Hz.
  135.   Procedure NOSOUND turns off the speaker.
  136.   Function RANDOM has two forms.  Without a parameter, it returns a random
  137.      number of type real greater than or equal to 0 and less than 1.
  138.      Written with a parameter, RANDOM(x:integer) returns a random number of
  139.      type integer greater than or equal to 0 and less than x.
  140.   Procedure RANDOMIZE reseeds the random number generator with a random value.
  141.   Function INKEY returns a string of length 0,1, or 2.  If no character is
  142.      in the keyboard buffer, Inkey returns the empty string.  A regular
  143.      ASCII or graphics character is returned as a string of length 1.
  144.      Extended codes for function keys, cursor control keys, etc., are returned
  145.      in a string of length 2.  The first character is NUL (chr(0)); the
  146.      second is the extended code.  Inkey emulates the INKEY$ variable in
  147.      BASIC.
  148.  
  149. WRITE (and WRITELN) output to the screen only, since files are not implemented.
  150.    Maximum output line length is 80.  A CR/LF is inserted automatically if this
  151.    maximum is exceeded.  Default field widths are: integers - 8, reals - 20,
  152.    booleans - 8, chars - 1, strings - their current dynamic length.  Defaults
  153.    may be overridden.  Note that, in Pascal, field widths are minimums, not
  154.    maximums.
  155.  
  156. GET and PUT are not implemented.
  157.  
  158. OPERATORS: &, |, ~ are synonyms for AND, OR, NOT, respectively.
  159.  
  160. CASE statement: maximum number of cases is 30.
  161.  
  162.  
  163.  
  164. STRINGS
  165.  
  166.    All strings in Facilis are dynamic.  That is, they have no fixed length.
  167. A single string may be up to 32748 characters long.  Collectively, strings
  168. may occupy all available memory.
  169.    String literals are denoted in the usual way, enclosed in single quotes.
  170.    A string variable is declared thus:
  171.          VAR s: STRING;
  172. For compatibility with other compilers, it is permitted to specify a length:
  173.          VAR t: STRING[10];
  174. However, the constant is ignored; string t is still fully dynamic.
  175. Strings may occur as elements of arrays and records.
  176.  
  177. COMPATIBILITY: In general, strings are compatible with chars.  I.e., a char
  178.    may be used where a string type is expected, and a string of length 1 may
  179.    be used where a char is expected.  Exceptions are cases that don't make
  180.    much sense: e.g., a string may not be given as the parameter to Ord, and
  181.    a char may not be the second parameter to Pos.
  182.    An ARRAY OF CHAR is assignment-compatible with strings.  A char array
  183.    value may be assigned to any string, which assumes a length equal to the
  184.    size of the array.  A string value may be assigned to a char array, also.
  185.    If the string is too long to fit, it is truncated; if it is too short,
  186.    it is padded with blanks on the right.  String functions other than
  187.    assignment may not be applied directly to a char array; assign the array
  188.    to a string variable first.
  189.  
  190. INDEXING: A string variable may be indexed with an integer expression in
  191.    square brackets, as though it were a char array.  Thus, s[5] is the 5th
  192.    character in string s.  Indexing beyond the current length of the string
  193.    results in a runtime error.  Indexed strings may not appear on the left
  194.    side of assignment statements, nor may they be passed as VAR parameters.
  195.  
  196. RELATIONAL operators =, <>, <=, >=, <, and > may be used to compare strings.
  197.    The collating sequence is ASCII.
  198.  
  199. LENGTH(st) function returns an integer equal to the length of string st.
  200.  
  201. CONCAT function is not implemented.  The + operator is used for concatenation.
  202.  
  203. COPY(st,p,n) function returns the substring of length n, starting at position
  204.    p, of string st.  If p < 1 or p > Length(st), the null string is returned.
  205.    If p+n exceeds Length(st), Copy returns all characters from position p to
  206.    the end of the string.
  207.  
  208. POS(s,t) function returns an integer equal to the position of the first
  209.    occurrence of string s as a substring in string t.  Pos returns 0 if s
  210.    is not contained in t.
  211.  
  212. STR and VAL are implemented as functions rather then as procedures as in some
  213.    other extended Pascals.  Str(n) accepts an integer or real parameter n, and
  214.    returns a string representing the number as it would be printed.
  215.    Val(st) takes a string parameter representing an integer, and returns the
  216.    integer's value.  A separate function Rval(st) does the same for reals.
  217.    String st must not contain leading or trailing blanks.  Val (Rval)
  218.    returns 0 if st does not represent a valid integer (real).
  219.  
  220. INSERT and DELETE are not provided as builtin procedures.  They may readily
  221.    be programmed as ordinary procedures, however.
  222.  
  223. MAXAVAIL function returns an integer value, the size of the largest remaining
  224.    block of string memory.  Value is in paragraphs, 16 bytes to a paragraph.
  225.  
  226.  
  227.  
  228. COMPILER ERROR MESSAGES
  229.  
  230.  0  undefined identifier
  231.  1  attempt at multiple definition
  232.  2  identifier expected
  233.  3  'PROGRAM' expected
  234.  4  ')' expected
  235.  5  ':' expected
  236.  6  syntax error
  237.  7  identifier or 'VAR' expected
  238.  8  'OF' expected
  239.  9  '(' expected
  240. 10  type expected
  241. 11  '[' expected
  242. 12  ']' expected
  243. 13  '..' expected
  244. 14  ';' expected
  245. 15  error in function result type
  246. 16  '=' expected
  247. 17  expression must have BOOLEAN result
  248. 18  invalid type for control variable
  249. 19  type conflict between control variable and expression
  250. 20    (not used)
  251. 21  number too large
  252. 22  '.' expected
  253. 23  invalid expression type following CASE
  254. 24  illegal character
  255. 25  identifier of type CONST expected
  256. 26  array index type conflict
  257. 27  type conflict in declaration of array index bounds
  258. 28  no such array
  259. 29  type identifier expected
  260. 30  undefined type
  261. 31  no such record
  262. 32  BOOLEAN type expected
  263. 33  arithmetic type expected
  264. 34  INTEGER type expected
  265. 35  incompatible operands of relation operator
  266. 36  actual/formal parameter type conflict
  267. 37  variable identifier expected
  268. 38  string expected
  269. 39  wrong number of actual parameters
  270. 40  ill-formed number
  271. 41  incorrect type
  272. 42  type REAL expected
  273. 43  integer expected
  274. 44  variable or constant expected
  275. 45  variable or procedure identifier expected
  276. 46  incompatible operands of ':='
  277. 47  label type incompatible with selecting expression
  278. 48  incorrect parameter type
  279. 49    (not used)
  280. 50  constant expected
  281. 51  ':=' expected
  282. 52  'THEN' expected
  283. 53  'UNTIL' expected
  284. 54  'DO' expected
  285. 55  'TO' or 'DOWN TO' expected
  286. 56  'BEGIN' expected
  287. 57  'END' expected
  288. 58  factor expected
  289. 59  ',' expected
  290. 60  indexed string not allowed here
  291. 61  structured variable too large
  292.  
  293.  
  294. REFERENCES
  295.  
  296. K. Jensen and N. Wirth, PASCAL USER MANUAL AND REPORT, Springer-Verlag,
  297.    New York.  Accepted as the definition of "standard" Pascal.
  298.  
  299. R.E. Berry, PROGRAMMING LANGUAGE TRANSLATION, John Wiley & Sons, New York.
  300.    Explains the Pascal S compiler in detail.  Includes source code.
  301.  
  302. TURBO PASCAL REFERENCE MANUAL, Borland International, Scotts Valley, CA.
  303.    Reference for the Facilis implementation language.
  304.  
  305.  
  306.  
  307. SUPPORT
  308.  
  309.    The Facilis project is an effort of volunteer amateurs who gather
  310. electronically on the RBBS-PC operated by
  311.               John Naleszkiewicz
  312.               (301)468-1439 (data)
  313.               6:30pm to 8:30am weekdays
  314.               24Hrs weekends.
  315. The latest version is always available for downloading by the public.
  316. All users are encouraged to contribute their comments, suggestions, and
  317. bug reports.
  318. ailable for downloading by the public.
  319. All users