home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / amiga_e-2.1b.lha / Amiga_E-2.1b / Docs / Utilities / Yax.doc < prev   
Encoding:
Text File  |  1993-10-05  |  4.1 KB  |  143 lines

  1.  
  2.         +---------------------------------------+
  3.         |                                       |
  4.         |       Amiga YAX Interpreter v0.x      |
  5.         |                                       |
  6.         |             (c) 1992 $#%!             |
  7.         |              M A N U A L              |
  8.         |                                       |
  9.         +---------------------------------------+
  10.  
  11.             1. Introduction
  12.             2. The Language
  13.             3. Built-in Functions
  14.  
  15.         +---------------------------------------+
  16.         |    1. Introduction            |
  17.         +---------------------------------------+
  18.  
  19. YAX stands for "Yet Another Instruction Code Set", as the author couldn't
  20. think of better name. YAX is a procedural language with LISP-syntax and
  21. evaluation, as well as somewhat lambda function application.
  22.  
  23. In this manual it is asumed the reader possesses knowledge of other
  24. languages, as all 'obvious' explanations are left out. Readers for whom
  25. YAX would be their first programming language are advised to read
  26. a standard text on the subject  8-).
  27.  
  28.         +---------------------------------------+
  29.         |    2. The Language            |
  30.         +---------------------------------------+
  31.  
  32. Structure.
  33. The basic building block of a YAX program is called a term.
  34. Examples of terms are:
  35.  
  36. integer constants:    1 2 100 -1
  37. string constants:    'a' 'hi folks!'
  38. variables:        a count
  39. function calls:        (+ 1 2) (* 3 (- 4 5))
  40.  
  41. a function call is a list '()' with as first item the name of the
  42. function to be applied, followed by its arguments. With few execeptions,
  43. arguments to functions are again terms, so expressions may be built
  44. to infinite complexity. The main task of the interpreter is to
  45. evaluate these terms recursively.
  46.  
  47. Format.
  48. between any two lexical elements, any number of spaces, tabs and linefeeds
  49. may be placed. Comments start with '/*' and end with '/*', may extend
  50. over several lines, and may be nested. following to statements are equal:
  51.  
  52. (if(eq a 1)(for b 1 10(write'blabla')))       /* ugly */
  53.  
  54. (if (eq a 1)
  55.   (for b 1 10 (write 'blabla'))               /* better */
  56. )
  57.  
  58.  
  59.         +---------------------------------------+
  60.         |    3. Built-in Functions        |
  61.         +---------------------------------------+
  62.  
  63. If not explicitly stated, functions return 0. type of arguments:
  64.  
  65. <term>        any term
  66. <iterm>        term that evaluates to integer
  67. <sterm>        term that evaluates to string
  68. <var>        term that is a variable
  69. <svar>        term that is a string variable
  70. <func>        term that evaluates to a function
  71. ...        any number of terms of the same type may follow
  72.  
  73.                            --> INTEGER MATH <--
  74.  
  75. (add <iterm> ...)     or    (+ <iterm> ...)
  76. (sub <iterm> ...)     or    (- <iterm> ...)
  77. (mul <iterm> ...)     or    (* <iterm> ...)
  78. (div <iterm> ...)     or    (/ <iterm> ...)
  79.  
  80. (and <iterm> ...)
  81. (or <iterm> ...)
  82. (not <iterm>)
  83.  
  84. (eq <iterm> ...)
  85. (uneq <iterm> <iterm>)
  86. (smaller <iterm> <iterm>)
  87. (greater <iterm> <iterm>)
  88.  
  89. These functions perform the functions you'd expect them to do.
  90. All boolean logic functions return true (-1) or false (0). and/or/not
  91. work as logical as well as bitwise operators.
  92. except for the last three, all functions handle any number of arguments,
  93. i.e.  (eq 10 (+ 1 2 3 4) (* 2 5))  is a valid term.
  94.  
  95.                          --> PROGRAM STRUCTURE <--
  96.  
  97. (for <var> <iterm> <iterm> <term> ...)
  98. (if <boolexp> <ifterm> <elseterm>)
  99. (do <term> ...)
  100. (select <iterm> <term> ...)
  101. (while <term> <term> ...)
  102. (until <term> <term> ...)
  103. (set <var> <term>)
  104.  
  105. (defun <var> (<var> ...) <term> ...)
  106. (lambda (var ...) <term> ...)
  107. (apply <func> <term> ...)
  108.  
  109. (array <var> <iterm>)
  110. (string <var>)
  111.  
  112.  
  113.                            --> INPUT OUTPUT <--
  114.  
  115. (write <term> ...)
  116. (locate <iterm> <iterm>)
  117. (cls)
  118. (window <iterm> <iterm> <iterm> <iterm> <sterm>)
  119.  
  120. (tell <sterm>)            open a file for writing
  121. (told)                close file
  122. (see <sterm>)            open a file for reading
  123. (seen)                close file
  124. (filelen <sterm>)        get filelength
  125.  
  126. (readint)            read an integer
  127. (read <svar>)            read a string
  128. (get)                read one character
  129. (put <iterm>)            write one character
  130.  
  131. (dump)                show all variables
  132.  
  133.  
  134.                              --> GRAPHICS <--
  135.  
  136. (line <iterm> <iterm> <iterm> <iterm> <iterm>)
  137. (plot <iterm> <iterm> <iterm>)
  138. (box <iterm> <iterm> <iterm> <iterm> <iterm>)
  139. (text <iterm> <iterm> <iterm> <iterm> <sterm>)
  140. (mousex)
  141. (mousey)
  142. (mouse)
  143.