ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2215 lines
83 KiB

  1. ORIGINAL: http://buraphakit.sourceforge.net/ECMA-55.TXT
  2. ECMA
  3. EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION
  4. ___________________________________________
  5. STANDARD ECMA-55
  6. Minimal BASIC
  7. January 1978
  8. +--------------------------------------------------------+
  9. | |
  10. | Free copies of this ECMA standard are available from |
  11. | ECMA European Computer Manufacturers Association |
  12. | 114 Rue du Rhône - 1204 Geneva (Switzerland) |
  13. | |
  14. +--------------------------------------------------------+
  15. ECMA
  16. EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION
  17. ___________________________________________
  18. STANDARD ECMA-55
  19. Minimal BASIC
  20. January 1978
  21. BRIEF HISTORY
  22. _____________
  23. The first version of the language BASIC, acronym for _Beginner's
  24. _All-purpose _Symbolic _Instruction _Code, was produced in 1964 at
  25. the Dartmouth College in the USA. This version of the language
  26. was oriented towards interactive use. Subsequently, a number of
  27. implementations of the language were prepared, that differed in
  28. part from the original one.
  29. In 1974, the ECMA General Assembly recognized the need for a
  30. standardized version of the language, and in September 1974 the
  31. first meeting of the ECMA Committee TC 21, BASIC, took place.
  32. In January 1974, a corresponding committee, X3J2, had been found-
  33. ed in the USA.
  34. Through a strict co-operation it was possible to maintain full
  35. compatibility between the ANSI and ECMA draft standards. The ANSI
  36. one was distributed for public comments in January 1976, and a
  37. number of comments were presented by ECMA.
  38. A final version of the ECMA Standard was prepared at the meeting
  39. of June 1977 and adopted by the General Assembly of ECMA on
  40. Dec. 14, 1977 as Standard ECMA-55.
  41. _T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S
  42. _P_a_g_e
  43. 1. SCOPE 1
  44. 2. REFERENCES 1
  45. 3. DEFINITIONS 1
  46. 3.1 BASIC 1
  47. 3.2 Batch Mode 1
  48. 3.3 End-of-Line 2
  49. 3.4 Error 2
  50. 3.5 Exception 2
  51. 3.6 Identifier 2
  52. 3.7 Interactive Mode 2
  53. 3.8 Keyword 2
  54. 3.9 Line 2
  55. 3.10 Nesting 2
  56. 3.11 Print Zone 3
  57. 3.12 Rounding 3
  58. 3.13 Significant Digits 3
  59. 3.14 Truncation 3
  60. 4. CHARACTERS AND STRINGS 3
  61. 5. PROGRAMS 5
  62. 6. CONSTANTS 6
  63. 7. VARIABLES 8
  64. 8. EXPRESSIONS 9
  65. 9. IMPLEMENTATION SUPPLIED FUNCTIONS 11
  66. 10. USER DEFINED FUNCTIONS 13
  67. 11. LET STATEMENT 14
  68. 12. CONTROL STATEMENTS 15
  69. 13. FOR AND NEXT STATEMENTS 17
  70. 14. PRINT STATEMENT 19
  71. 15. INPUT STATEMENT 21
  72. 16. READ AND RESTORE STATEMENTS 23
  73. 17. DATA STATEMENT 24
  74. 18. ARRAY DECLARATIONS 25
  75. 19. REMARK STATEMENT 26
  76. 20. RANDOMIZE STATEMENT 26
  77. TABLE 1 - BASIC Character Set 28
  78. TABLE 2 - BASIC Code 29
  79. APPENDIX 1 - Organization of the Standard 30
  80. APPENDIX 2 - Method of Syntax Specification 32
  81. APPENDIX 3 - Conformance 34
  82. APPENDIX 4 - Implementation-defined Features 35
  83. - 1 -
  84. 1. _S_C_O_P_E
  85. This Standard ECMA-55 is designed to promote the interchangeabi-
  86. lity of BASIC programs among a variety of automatic data process-
  87. ing systems. Subsequent Standards for the same purpose will de-
  88. scribe extensions and enhancements to this Standards. Programs
  89. conforming to this Standard, as opposed to extensions or enhance-
  90. ments of this Standard, will be said to be written in "Minimal
  91. BASIC".
  92. This Standard establishes:
  93. - the syntax of a program written in Minimal BASIC.
  94. - The formats of data and the precision and range of numeric re-
  95. presentations which are acceptable as input to an automatic
  96. data processing system being controlled by a program written
  97. in Minimal BASIC.
  98. - The semantic rules for interpreting the meaning of a program
  99. written in Minimal BASIC.
  100. - The errors and exceptional circumstances which shall be detect-
  101. ed and also the manner in which such errors and exceptional cir-
  102. cumstance shall be handled.
  103. Although the BASIC language was originally designed primarily for
  104. interactive use, this Standard describes a language that is not
  105. so restricted.
  106. The organization of the Standard is outlined in Appendix 1. The
  107. method of syntax specification used is explained in Appendix 2.
  108. 2. _R_E_F_E_R_E_N_C_E_S
  109. ECMA-6 : 7-Bit Input/Output Coded Character Set, 4th Edition
  110. ECMA-53 : Representation of Source Programs
  111. 3. _D_E_F_I_N_I_T_I_O_N_S
  112. For the purposes of this Standard, the following terms have the
  113. meanings indicated.
  114. 3.1 _B_A_S_I_C
  115. A term applied as a name to members of a special class of lan-
  116. guages which possess similar syntaxes and semantic meanings;
  117. acronym for Beginner's All-purpose Symbolic Instruction Code.
  118. 3.2 _B_a_t_c_h_-_m_o_d_e
  119. The processing of programs in an environment where no provision
  120. is made for user interaction.
  121. - 2 -
  122. 3.3 _E_n_d_-_o_f_-_l_i_n_e
  123. The character(s) or indicator which identifies the termination
  124. of a line. Lines of three kinds may be identified in Minimal
  125. BASIC: program lines, print lines and input reply lines.
  126. End-of-line may vary between the three cases and may also vary
  127. depending upon context. Thus, for example, an end of input
  128. line may vary on a given system depending on the terminal being
  129. used in interactive or batch mode.
  130. Typical examples of end-of-line are carriage-return, carriage-
  131. return line-feed, and end of record (such as end of card).
  132. 3.4 _E_r_r_o_r
  133. A flaw in the syntax of a program which causes the program to
  134. be incorrect.
  135. 3.5 _E_x_c_e_p_t_i_o_n
  136. A circumstance arising in the course of executing a program
  137. which results from faulty data or computations or from exceed-
  138. ing some resource constraint. Where indicated certain excep-
  139. tions (non-fatal exceptions) may be handled by the specified
  140. procedures; if no procedure is given (fatal exceptions) or if
  141. restrictions imposed by the hardware or operating environment
  142. make it impossible to follow the given procedure, then the ex-
  143. ception shall be handled by terminating the program.
  144. 3.6 _I_d_e_n_t_i_f_i_e_r
  145. A character string used to name a variable or a function.
  146. 3.7 _I_n_t_e_r_a_c_t_i_v_e_ _m_o_d_e
  147. The processing of programs in an environment which permits the
  148. user to respond directly to the actions of individual programs
  149. and to control the commencement and termination of those pro-
  150. grams.
  151. 3.8 _K_e_y_w_o_r_d
  152. A character string, usually with the spelling of a commonly
  153. used or mnemonic word, which provides a distinctive identifi-
  154. cation of a statement or a component of a statement of a pro-
  155. gramming language.
  156. The keywords in Minimal BASIC are: BASE, DATA, DEF, DIM, END,
  157. FOR, GO, GOSUB, GOTO, IF, INPUT, LET, NEXT, ON, OPTION, PRINT,
  158. RANDOMIZE, READ, REM, RESTORE, RETURN, STEP, STOP, SUB, THEN
  159. and TO.
  160. 3.9 _L_i_n_e
  161. A single transmission of characters which terminates with an
  162. end-of-line.
  163. 3.10 _N_e_s_t_i_n_g
  164. A set of statements is nested within another set of statements
  165. when:
  166. - 3 -
  167. - the nested set is physically contiguous, and
  168. - the nesting set (divided by the nested set) is non-null.
  169. 3.11 _P_r_i_n_t_ _z_o_n_e
  170. A contiguous set of character positions in a printed output
  171. line which may contain an evaluated print statement element.
  172. 3.12 _R_o_u_n_d_i_n_g
  173. The process by which the representation of a value with lower
  174. precision is generated from a representation of higher preci-
  175. sion taking into account the value of that portion of the ori-
  176. ginal number which is to be omitted.
  177. 3.13 _S_i_g_n_i_f_i_c_a_n_t_ _d_i_g_it_s
  178. The contiguous sequence of digits between the high-order non-
  179. zero digit and the low-order non-zero digit, without regard
  180. for the location of the radix point. Commonly, in a normalized
  181. floating point internal representation, only the significant
  182. digits of a representation are maintained in the significance.
  183. NOTE: The Standard requires that the ability of a conforming
  184. implementation to accept numeric representations be
  185. measured in terms of significant digits rather than the
  186. actual number of digits (that is including leading or
  187. trailing zeroes) in the representation.
  188. 3.14 _T_r_u_n_c_a_t_i_o_n
  189. The process by which the representation of a value with lower
  190. precision is generated from a representation of higher preci-
  191. sion by merely deleting the unwanted low order digits of the
  192. original representation.
  193. 4. _C_H_A_R_A_C_T_E_R_S_ _A_N_D_ _S_T_R_I_N_G_S
  194. 4.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  195. The character set for BASIC is contained in the ECMA 7-bit
  196. coded character set. Strings are sequences of characters and
  197. are used in BASIC programs as comments (see 19), as string con-
  198. stants (see 6), or as data (see 15).
  199. 4.2 _S_y_n_t_a_x
  200. 1. letter = A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/
  201. U/V/W/X/Y/Z
  202. 2. digit = 0/1/2/3/4/5/6/7/8/9
  203. 3. string-character = quotation-mark / quoted-string-character
  204. 4. quoted-string- = exclamation-mark / number-sign / dollar-
  205. character sign / percent-sign / ampersand /
  206. apostrophe / left-parenthesis / right-
  207. parenthesis / asterisk / comma / solidus /
  208. colon / semi-colon / less-than-sign /
  209. equals-sign / greater-than-sign /
  210. question-mark / circumflex-accent /
  211. underline / unquoted-string-character
  212. 5. unquoted-string- = space / plain-string-character
  213. character
  214. - 4 -
  215. 6. plain-string- = plus-sign / minus-sign / full-stop /
  216. character digit / letter
  217. 7. remark-string = string-character*
  218. 8. quoted-string = quotation-mark quoted-string-character*
  219. quotation-mark
  220. 9. unquoted-string = plain-string-character /
  221. plain-string-character
  222. unquoted-string-character*
  223. plain-string-character
  224. 4.3 _E_x_a_m_p_l_e_s
  225. ANY CHARACTERS AT ALL (?!*!!) CAN BE USED IN A "REMARK".
  226. "SPACES AND COMMAS CAN OCCUR IN QUOTED STRINGS."
  227. COMMAS CANNOT OCCUR IN UNQUOTED STRINGS.
  228. 4.4 _S_e_m_a_n_t_i_c_s
  229. The letters shall be the set of upper-case Roman letters con-
  230. tained in the ECMA 7-bit coded character set in positions 4/1
  231. to 5/10.
  232. The digits shall be the set of arabic digits contained in the
  233. ECMA 7-bit coded character set in positions 3/0 to 3/9.
  234. The remaining string-characters shall correspond to the remain-
  235. ing graphic characters in position 2/0 to 2/15, 3/10 to 3/15
  236. and in positions 5/14, 5/15 of the ECMA 7-bit coded character
  237. set.
  238. The names of characters are specified in Table 1.
  239. The coding of characters is specified in Table 2; however, this
  240. coding applies only when programs and/or input/output data are
  241. exchanged by means of coded media.
  242. 4.5 _E_x_c_e_p_t_i_o_n_s
  243. None.
  244. 4.6 _R_e_m_a_r_k_s
  245. Other characters from the ECMA 7-bit coded character set (in-
  246. cluding control characters) may be accepted by an implementation
  247. and may have a meaning to some other processor (such as an editor)
  248. but have no prescribed meaning within this Standard. Programs
  249. containing characters other than the string-characters described
  250. above are not standard-conforming programs.
  251. The several kinds of characters and strings described by the
  252. syntax correspond to the various uses of strings in a BASIC
  253. program. Remark-strings may be used in remark-statements (see
  254. 19). Quoted-strings may be used as string-constants (see 6).
  255. Unquoted-strings may be used in addition to quoted-strings as
  256. data elements (see 17) without being enclosed in quotation marks;
  257. unquoted-strings cannot contain leading or trailing spaces.
  258. - 5 -
  259. 5. _P_R_O_G_R_A_M_S
  260. 5.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  261. BASIC is a line-oriented language. A BASIC program is a sequence
  262. of lines, the last of which shall be an end-line and each of
  263. which contains a keyword. Each line shall contain a unique line-
  264. number which serves as a label for the statement contained in
  265. that line.
  266. 5.2 _S_y_n_t_a_x
  267. 1. program = block* end-line
  268. 2. block = (line/for-block)*
  269. 3. line = line-number statement end-of-line
  270. 4. line-number = digit digit? digit? digit?
  271. 5. end-of-line = [implementation defined]
  272. 6. end-line = line-number end-statement end-of-line
  273. 7. end-statement = END
  274. 8. statement = data-statement / def-statement /
  275. dimension -statement / gosub-statement /
  276. goto-statement / if-then-statement /
  277. input-statement / let-statement /
  278. on-goto-statement / option-statement /
  279. print-statement / randomize-statement /
  280. read-statement / remark-statement /
  281. restore-statement / return-statement /
  282. stop statement
  283. 5.3 _E_x_a_m_p_l_e_s
  284. 999 END
  285. 5.4 _S_e_m_a_n_t_i_c_s
  286. A BASIC program shall be composed of a sequence of lines order-
  287. ed by line-numbers, the last of which contains an end-statement.
  288. Program lines shall be executed in sequential order, starting
  289. with the first line, until
  290. - some other action is dictated by a control statement, or
  291. - an exception condition occurs, which results in a termination
  292. of the program, or
  293. - a stop-statement or end-statement is executed.
  294. Special conventions shall be observed regarding spaces. With
  295. the following exceptions, spaces may occur anywhere in a BASIC
  296. program without affecting the execution of that program and
  297. may be used to improve the appearance and readability of the
  298. program.
  299. Spaces shall not appear:
  300. - at the beginning of a line
  301. - within keywords
  302. - within numeric constants
  303. - within line numbers
  304. - within function or variable names
  305. - within two-character relation symbols
  306. - 6 -
  307. All keywords in a program shall be preceded by at least one
  308. space and, if not at the end of a line, shall be followed by
  309. at least one space.
  310. Each line shall begin with a line-number. The values of the
  311. integers represented by the line-numbers shall be positive
  312. nonzero; leading zeroes shall have no effect. Statements shall
  313. occur in ascending line-number order.
  314. The manner in which the end of a statement line is detected is
  315. determined by the implementation; e.g. the end-of-line may be
  316. a carriage-return character, a carriage-return character follow-
  317. ed by a line-feed character, or the end of a physical record.
  318. Lines in a standard-conforming program may contain up to 72
  319. characters; the end-of-line indicator is not included within
  320. this 72 character limit.
  321. The end-statement serves both to mark the physical end of the
  322. main body of a program and to terminate the execution of the
  323. program when encountered.
  324. 5.5 _E_x_c_e_p_t_i_o_n_s
  325. None.
  326. 5.6 _R_e_m_a_r_k_s
  327. Local editing facilities may allow for the entry of statement
  328. lines in any order and also allow for duplicate line-numbers
  329. and lines containing only a line-number. Such editing facili-
  330. ties usually sort the program into the proper order and in the
  331. case of duplicate line-numbers, the last line entered with
  332. that line-number is retained. In many implementations, a line
  333. containing only a line-number (without trailing spaces) is
  334. usually deleted from the program.
  335. 6. _C_O_N_S_T_A_N_T_S
  336. 6.1 _G_e_n_e_r_a_l_ _d_e_s_c_r_i_p_t_i_o_n
  337. Constants can denote both scalar numeric values and string
  338. values.
  339. A numeric-constant is a decimal representation in positional
  340. notation of a number. There are four general syntactic forms
  341. of (optionally signed) numeric constants:
  342. - implicit point representation sd...d
  343. - explicit point unscaled representation sd..drd..d
  344. - explicit point scaled representation sd..drd..dEsd..d
  345. - implicit point scaled representation sd..dEsd..d
  346. where:
  347. d is a decimal digit,
  348. r is a full-stop
  349. s is an optional sign, and
  350. E is the explicit character E.
  351. - 7 -
  352. A string-constant is a character string enclosed in quotation
  353. marks (see 4).
  354. 6.2 _S_y_n_t_a_x
  355. 1. numeric-constant = sign? numeric-rep
  356. 2. sign = plus-sign / minus-sign
  357. 3. numeric-rep = significand exrad?
  358. 4. significand = integer full-stop? / integer? fraction
  359. 5. integer = digit digit*
  360. 6. fraction = full-stop digit digit*
  361. 7. exrad = E sign? integer
  362. 8. string-constant = quoted-string
  363. 6.3 _E_x_a_m_p_l_e_s
  364. 1 500 -21. .255 1E10
  365. 5E-1 .4E+1
  366. "XYZ" "X - 3B2" "1E10"
  367. 6.4 _S_e_m_a_n_t_i_c_s
  368. The value of a numeric-constant is the number represented by
  369. that constant. "E" stands for "times ten to the power"; if no
  370. sign follows the symbol "E", then a plus sign is understood.
  371. Spaces shall not occur in numeric-constants.
  372. A program may contain numeric representations which have an
  373. arbitrary number of digits, though implementations may round
  374. the values of such representations to an implementation-defined
  375. precision of not less than six significant decimal digits. Numeric
  376. constants can also have an arbitrary number of digits in the ex-
  377. rad, though nonzero constants whose magnitude is outside an im-
  378. plementation-defined range will be treated as exceptions. The
  379. implementation-defined range shall be at least 1E-38 to 1E+38.
  380. Constants whose magnitudes are less than machine infinitesimal
  381. shall be replaced by zero, while constants whose magnitudes are
  382. larger than machine infinity shall be diagnosed as causing an
  383. overflow.
  384. A string-constant has as its value the string of all characters
  385. between the quotation marks; spaces shall not be ignored. The
  386. length of a string-constant, i.e. the number of characters con-
  387. tained between the quotation-marks, is limited only by the length
  388. of a line.
  389. 6.5 _E_x_c_e_p_t_i_o_n_s
  390. The evaluation of a numeric constant causes an overflow (non-
  391. fatal, the recommended recovery procedure is to supply machine
  392. infinity with the appropriate sign and continue).
  393. 6.6 _R_e_m_a_r_k_s
  394. Since this Standard does not require that strings with more
  395. than 18 characters be assignable to string variables (see 7),
  396. conforming programs can use string constants with more than
  397. 18 characters only as elements in a print-list.
  398. - 8 -
  399. It is recommended that implementations report constants whose
  400. magnitudes are less than machine infinitesimal as underflows
  401. and continue.
  402. 7. _V_A_R_I_A_B_L_E_S
  403. 7.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  404. Variables in BASIC are associated with either numeric or
  405. string values and, in the case of numeric variables, may be
  406. either simple variables or references to elements of one or
  407. two dimensional arrays; such references are called subscript-
  408. ed variables.
  409. Simple numeric variables shall be named by a letter followed
  410. by an optional digit.
  411. Subscripted numeric variables shall be named by a letter fol-
  412. lowed by one or two numeric expressions enclosed within pa-
  413. rentheses.
  414. String variables shall be named by a letter followed by a
  415. dollar sign.
  416. Explicit declarations of variable types are not required; a
  417. dollar-sign serves to distinguish string from numeric variab-
  418. les, and the presence of a subscript distinguishes a sub-
  419. scripted variable from a simple one.
  420. 7.2 _S_y_n_t_a_x
  421. 1. variable = numeric-variable / string-variable
  422. 2. numeric-variable = simple-numeric-variable /
  423. numeric-array-element
  424. 3. simple-numeric- = letter digit?
  425. variable
  426. 4. numeric-array-element = numeric-array-name subscript
  427. 5. numeric-array-name = letter
  428. 6. subscript = left-parenthesis numeric-expression
  429. (comma numeric-expression)? right-
  430. parenthesis
  431. 7. string-variable = letter dollar-sign
  432. 7.3 _E_x_a_m_p_l_e_s
  433. X A5 V(3) W(X,X+Y/2)
  434. S$ C$
  435. 7.4 _S_e_m_a_n_t_i_c_s
  436. At any instant in the execution of a program, a numeric-
  437. variable is associated with a single numeric value and a
  438. string-variable is associated with a single string value.
  439. The value associated with a variable may be changed by the
  440. execution of statements in the program.
  441. - 9 -
  442. The length of the character string associated with a string-
  443. variable can vary during the execution of a program from a
  444. length of zero characters (signifying the null or empty string)
  445. to 18 characters.
  446. Simple-numeric-variables and string-variables are declared im-
  447. plicitly through their appearance in a program.
  448. A subscripted variable refers to the element in the one or two
  449. dimensional array selected by the value(s) of the subscript(s).
  450. The value of each subscript is rounded to the nearest integer.
  451. Unless explicitly declared in a dimension statement, subscript-
  452. ed variables are implicitly declared by their first appearance
  453. in a program. In this case the range of each subscript is from
  454. zero to ten inclusive, unless the presence of an option-state-
  455. ment indicates that the range is from one to ten inclusive. Sub-
  456. script expressions shall have values within the appropriate range
  457. (see 18).
  458. The same letter shall not be the name of both a simple variable
  459. and an array, nor the name of both a one-dimensional and a two-
  460. dimensional array.
  461. There is no relationship between a numeric-variable and a string-
  462. variable whose names agree except for the dollar-sign.
  463. At the initiation of execution the values associated with all
  464. variables shall be implementation-defined.
  465. 7.5 _E_x_c_e_p_t_i_o_n_s
  466. A subscript is not in the range of the explicit or implicit
  467. dimensioning bounds (fatal).
  468. 7.6 _R_e_m_a_r_k_s
  469. Since initialization of variables is not specified, and hence
  470. may vary from implementation to implementation, programs that
  471. are intended to be transportable should explicitly assign a
  472. value to each variable before any expression involving that
  473. variable is evaluated.
  474. There are many commonly used alternatives for associating im-
  475. plementation-defined initial values with variables; it is re-
  476. commended that all variables are recognizably undefined in the
  477. sense that an exception will result from any attempt to access
  478. the value of any variable before that variable is explicitly
  479. assigned a value.
  480. 8. _E_X_P_R_E_S_S_I_O_N_S
  481. 8.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  482. Expressions shall be either numeric-expressions or string-
  483. expressions.
  484. Numeric-expressions may be constructed from variables, constants,
  485. and function references using the operations of addition, sub-
  486. traction, multiplication, division and involution.
  487. - 10 -
  488. String-expressions are composed of either a string-variable or
  489. a string-constant.
  490. 8.2 _S_y_n_t_a_x
  491. 1. expression = numeric-expression / string-expression
  492. 2. numeric-expression = sign? term (sign term)*
  493. 3. term = factor (multiplier factor)*
  494. 4. factor = primary (circumflex-accent primary)*
  495. 5. multiplier = asterisk / solidus
  496. 6. primary = numeric-variable / numeric-rep / numeric-
  497. function-ref / left-parenthesis numeric-
  498. expression
  499. right-parenthesis
  500. 7. numeric-function- = numeric-function-name
  501. ref argument-list?
  502. 8. numeric-function- = numeric-defined-function /
  503. name numeric-supplied-function
  504. 9. argument-list = left-parenthesis argument
  505. right-parenthesis
  506. 10. argument = string-expression
  507. 11. string-expression = string-variable / string-constant
  508. 8.3 _E_x_a_m_p_l_e_s
  509. 3*X - Y^2 A(1)+A(2)+A(3) 2^(-X)
  510. -X/Y SQR(X^2+Y^2)
  511. 8.4 _S_e_m_a_n_t_i_c_s
  512. The formation and evaluation of numeric-expressions follows the
  513. normal algebraic rules. The symbols circumflex-accent, asterisk,
  514. solidus, plus-sign and minus-sign represent the operations of
  515. involution, multiplication, division, addition and subtraction,
  516. respectively. Unless parentheses dictate otherwise, involutions
  517. are performed first, then multiplications and divisions, and
  518. finally additions and subtractions. In the absence of parenthe-
  519. ses, operations of the same precedence are associated to the
  520. left.
  521. A-B-C is interpreted as (A-B)-C, A^B^C as (A^B)^C, A/B/C as
  522. (A/B)/C and -A^B as -(A^B).
  523. If an underflow occurs in the evaluation of a numeric expression
  524. then the value generated by the operation which resulted in the
  525. underflow shall be replaced by zero.
  526. 0^0 is defined to be 1, as in ordinary mathematical usage.
  527. When the order of evaluation of an expression is not constrained
  528. by the use of parentheses, and if the mathematical use of opera-
  529. tors is associative, commutative, or both, then full use of these
  530. properties may be made in order to revise the order of evalua-
  531. tion of the expression.
  532. In a function reference, the number of arguments supplied shall
  533. be equal to the number of parameters required by the definition
  534. of the function.
  535. - 11 -
  536. A function reference is a notation for the invocation of a pre-
  537. defined algorithm, into which the argument value, if any, is
  538. substituted for the parameter (see 9 and 10) which is used in
  539. the function definition. All functions referenced in an express-
  540. ion shall either be implementation-supplied or be defined in a
  541. def-statement. The result of the evaluation of the function,
  542. achieved by the execution of the defining algorithm, is a scalar
  543. numeric value which replaces the function reference in the ex-
  544. pression.
  545. 8.5 _E_x_c_e_p_t_i_o_n_s
  546. - Evaluation of an expression results in division by zero
  547. (nonfatal, the recommended recovery procedure is to supply
  548. machine infinity with the sign of the numerator and continue)
  549. - Evaluation of an expression results in an overflow (nonfatal,
  550. the recommended recovery procedure is to supply machine in-
  551. finity with the algebraically correct sign and continue).
  552. - Evaluation of the operation of involution results in a nega-
  553. tive number being raised to a non-integral power (fatal).
  554. - Evaluation of the operation of involution results in a zero be-
  555. ing raised to a negative value (nonfatal, the recommended re-
  556. covery procedure is to supply positive machine infinity and
  557. continue).
  558. 8.6 _R_e_m_a_r_k_s
  559. The accuracy with which the evaluation of an expression takes
  560. place will vary from implementation to implementation. While no
  561. minimum accuracy is specified for the evaluation of numeric-
  562. expressions, it is recommended that implementations maintain at
  563. least six significant decimal digits of precision.
  564. The method of evaluation of the operation of involution may
  565. depend upon whether or not the exponent is an integer. If it
  566. is, then the indicated number of multiplications may be per-
  567. formed; if it is not, then the expression may be evaluated
  568. using the LOG and EXP functions (see 9).
  569. It is recommended that implementations report underflow as an
  570. exception and continue.
  571. 9. _I_M_P_L_E_M_E_N_A_T_A_T_I_ON_ _S_U_P_P_L_I_E_D_ _F_U_N_C_T_I_O_N_S
  572. 9.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  573. Predefined algorithms are supplied by the implementation for
  574. the evaluation of commonly used numeric functions.
  575. 9.2 _S_y_n_t_a_x
  576. 1. numeric-supplied-function = ABS / ATN / COS / EXP / INT /
  577. LOG / RND / SGN / SIN / SQR / TAN
  578. 9.3 _E_x_a_m_p_l_e_s
  579. None.
  580. - 12 -
  581. 9.4 _S_e_m_a_n_t_i_c_s
  582. The values of the implementation-supplied functions, as well as
  583. the number of arguments required for each function, are described
  584. below. In all cases, X stands for a numeric expression.
  585. _F_u_n_c_t_i_o_n _F_u_n_c_t_i_o_n_ _v_a_l_u_e
  586. ABS(X) The absolute value of X.
  587. ATN(X) The arctangent of X in radians, i.e. the angle
  588. whose tangent is X. The range of the function
  589. is
  590. -(pi/2) < ATN(X) < (pi/2)
  591. where pi is the ratio of the circumference of
  592. a circle to its diameter.
  593. COS(X) The cosine of X, where X is in radians.
  594. EXP(X) The exponential of X, i.e. the value of the
  595. base of natural logarithms (e = 2,71828...)
  596. raised to the power X; if EXP(X) is less than
  597. machine infinitesimal, then its value shall
  598. be replaced by zero.
  599. INT(X) The largest integer not greater than X; e.g.
  600. INT(1.3) = 1 and INT(-1.3) = -2.
  601. LOG(X) The natural logarithm of X; X must be greater
  602. than zero.
  603. RND The next pseudo-random number in an implemen-
  604. tation-supplied sequence of pseudo-random num-
  605. bers uniformly distributed in the range 0 <=
  606. RND < 1 (see also 20).
  607. SGN(X) The sign of X: -1 if X < 0, 0 if X = 0 and
  608. +1 if X > 0.
  609. SIN(X) The sine of X, where X is in radians.
  610. SQR(X) The nonnegative square root of X; X must be
  611. nonnegative.
  612. TAN(X) The tangent of X, where X is in radians.
  613. 9.5 _E_x_c_e_p_t_i_o_n_s
  614. - The value of the argument of the LOG function is zero or ne-
  615. gative (fatal).
  616. - The value of the argument of the SQR function is negative
  617. (fatal).
  618. - The magnitude of the value of the exponential or tangent
  619. function is larger than machine infinity (nonfatal, the re-
  620. commended recovery procedure is to supply machine infinity
  621. with the appropriate sign and continue).
  622. - 13 -
  623. 9.6 _R_e_m_a_r_k_s
  624. The RND function in the absence of a randomize-statement (see
  625. 20) will generate the same sequence of pseudo-random numbers
  626. each time a program is run. This convention is chosen so that
  627. programs employing pseudo-random numbers can be executed se-
  628. veral times with the same result.
  629. It is recommended that, if the value of the exponential function
  630. is less than machine infinitesimal, implementations report this
  631. as an underflow and continue.
  632. 10. _U_S_E_R_ _D_E_F_I_N_E_D_ _F_U_N_C_T_I_O_N_S
  633. 10.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  634. In addition to the implementation supplied functions provided
  635. for the convenience of the programmer (see 9), BASIC allows
  636. the programmer to define new functions within a program.
  637. The general form of statements for defining functions is
  638. DEF FNx = expression
  639. or DEF FNx (parameter) = expression
  640. where x is a single letter and a parameter is a simple numeric-
  641. variable.
  642. 10.2 _S_y_n_t_a_x
  643. 1. def-statement = DEF numeric-defined-function
  644. parameter-list? equals-sign
  645. numeric-expression
  646. 2. numeric-defined-
  647. function = FN letter
  648. 3. parameter-list = left-parenthesis parameter
  649. right-parenthesis
  650. 4. parameter = simple-numeric-variable
  651. 10.3 _E_x_a_m_p_l_e_s
  652. DEF FNF(X) = X^4 - 1 DEF FNP = 3.14159
  653. DEF FNA(X) = A*X + B
  654. 10.4 _S_e_m_a_n_t_i_c_s
  655. A function definition specifies the means of evaluation the
  656. function in terms of the value of an expression involving the
  657. parameter appearing in the parameter-list and possibly other
  658. variables or constants. When the function is referenced, i.e.
  659. when an expression involving the function is evaluated, then
  660. the expression in the argument list for the function reference,
  661. if any, is evaluated and its value is assigned to the parameter
  662. in the parameter-list for the function definition (the number
  663. of arguments shall correspond exactly to the number of para-
  664. meters). The expression in the function definition is then eva-
  665. luated, and this value is assigned as the value of the function.
  666. - 14 -
  667. The parameter appearing in the parameter-list of a function
  668. definition is local to that definition, i.e. it is distinct
  669. from any variable with the same name outside of the function
  670. definition. Variables which do not appear in the parameter-
  671. list are the variables of the same name outside the function
  672. definition.
  673. A function definition shall occur in a lower numbered line
  674. than that of the first reference to the function. The expres-
  675. sion in a def-statement is not evaluated unless the defined
  676. function is referenced.
  677. If the execution of a program reaches a line containing a
  678. def-statement, then it shall proceed to the next line with no
  679. other effect.
  680. A function definition may refer to other defined functions,
  681. but not to the function being defined. A function shall be de-
  682. fined at most once in a program.
  683. 10.5 _E_x_c_e_p_t_i_o_n_s
  684. None.
  685. 11. _L_E_T_ _S_T_A_T_E_M_E_N_T
  686. 11.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  687. A let-statement provides for the assignment of the value of
  688. an expression to a variable. The general syntactic form of
  689. the let-statement shall be
  690. LET variable = expression
  691. 11.2 _S_y_n_t_a_x
  692. 1. let-statement = numeric-let-statement /
  693. string-let-statement
  694. 2. numeric-let-statement = LET numeric-variable equals-sign
  695. numeric-expression
  696. 3. string-let-statement = LET string-variable equals-sign
  697. string-expression
  698. 11.3 _E_x_a_m_p_l_e_s
  699. LET P = 3.14159
  700. LET A(X,3) = SIN(X)*Y + 1
  701. LET A$ = "ABC"
  702. LET A$ = B$
  703. 11.4 _S_e_m_a_n_t_i_c_s
  704. The expression is evaluated (see 8) and its value is assigned
  705. to the variable to the left of the equals sign.
  706. 11.5 _E_x_c_e_p_t_i_o_n_s
  707. A string datum contains too many characters (fatal).
  708. - 15 -
  709. 12. _C_O_N_T_R_O_L_ _S_T_A_T_E_M_E_N_T_S
  710. 12.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  711. Control statements allow for the interruption of the normal
  712. sequence of execution of statements by causing execution to
  713. continue at a specified line, rather than at the one with the
  714. next higher line number.
  715. The goto-statement
  716. GO TO line-number
  717. allows for an unconditional transfer.
  718. The if-then-statement
  719. IF exp1 rel exp2 THEN line-number
  720. where "exp1" and "exp2" are expressions and "rel" is a relation-
  721. al operator, allows for a conditional transfer.
  722. The gosub and return statements
  723. GO SUB line-number
  724. RETURN
  725. allow for subroutine calls.
  726. The on-goto-statement
  727. ON expression GO TO line-number, ..., line-number
  728. allows control to be transferred to a selected line.
  729. The stop-statement
  730. STOP
  731. allows for program termination.
  732. 12.2 _S_y_n_t_a_x
  733. 1. goto-statement = GO space* TO line-number
  734. 2. if-then-statement = IF relational-expression THEN
  735. line-number
  736. 3. relational-expression = numeric-expression relation
  737. numeric-expression / string-
  738. expression equality-relation
  739. string-expression
  740. 4. relation = equality-relation / less-than-
  741. sign / greater-than-sign / not-
  742. less / not-greater
  743. 5. equality-relation = equals-sign / not-equals
  744. 6. not-less = greater-than-sign equals-sign
  745. 7. not-greater = less-than-sign equals-sign
  746. 8. not-equals = less-than-sign greater-than-sign
  747. 9. gosub-statement = GO space* SUB line-number
  748. 10. return-statement = RETURN
  749. 11. on-goto-statement = ON numeric-expression GO space*
  750. TO line-number (comma line-number)*
  751. - 16 -
  752. 12. stop-statement = STOP
  753. 12.3 _E_x_a_m_p_l_e_s
  754. GO TO 999 IF X > Y+83 then 200
  755. IF A$ <> B$ THEN 550 ON L+1 GO TO 300,400,500
  756. 12.4 _S_e_m_a_n_t_i_c_s
  757. A goto-statement indicates that execution of the program is to
  758. be continued at the specified line-number.
  759. If the value of the relational-expression in an if-then-state-
  760. ment is true, then execution of the program shall continue from
  761. the specified line-number; if the value of the relational-ex-
  762. pression is false, then execution shall be continued in sequence,
  763. i.e. with the statement on the line following that containing
  764. the if-then-statement.
  765. The relation "less than or equal to" shall be denoted by <=.
  766. Similarly, "greater than or equal to" shall be denoted by >=,
  767. while "not equal to" shall be denoted by <>.
  768. The relation of equality holds between two strings if and only
  769. if the two strings have the same length and contain identical
  770. sequences of characters.
  771. The execution of the gosub-statement and the return-statement
  772. can be described in terms of a stack of line-numbers (but may
  773. be implemented in some other fashion). Prior to execution of
  774. the first gosub-statement by the program, this stack is empty.
  775. Each time a gosub-statement is executed, the line-number of
  776. the gosub-statement is placed on top of the stack and execution
  777. of the program is continued at the line specified in the gosub-
  778. statement. Each time a return-statement is executed, the line-
  779. number on top of the stack is removed from the stack and exe-
  780. cution of the program is continued at the line following the
  781. one with that line-number.
  782. It is not necessary that equal numbers of gosub-statements and
  783. return-statements be executed before termination of the program.
  784. The expression in an on-goto-statement shall be evaluated and
  785. rounded to obtain an integer, whose value is then used to select
  786. a line-number from the list following the GOTO (the line-numbers
  787. in the list are indexed from left to right, starting with 1).
  788. Execution of the program shall continue at the statement with
  789. the selected line-number.
  790. All line-numbers in control-statements shall refer to lines in
  791. the program.
  792. The stop-statement causes termination of the program.
  793. 12.5 _E_x_c_e_p_t_i_o_n_s
  794. - An attempt is made to execute a return-statement without
  795. having executed a corresponding gosub-statement (fatal).
  796. - 17 -
  797. - The integer obtained as the value of an expression in an
  798. on-goto-statement is less than one or greater than the
  799. number of line-numbers in the list (fatal).
  800. 13. _F_O_R_ _A_N_D_ _N_E_X_T_ _S_T_A_T_E_M_E_N_T_S
  801. 13.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  802. The for-statement and next-statement provide for the contruct-
  803. ion of loops. The general syntactic form of the for-statement
  804. and next-statement is
  805. FOR v = initial-value TO limit STEP increment
  806. NEXT v
  807. where "v" is a simple numeric variable and the "initial-value",
  808. "limit" and "increment" are numeric expressions; the clause
  809. "STEP increment" is optional.
  810. 13.2 _S_y_n_t_a_x
  811. 1. for-block = for-line for-body
  812. 2. for-body = block next-line
  813. 3. for-line = line-number for-statement end-of-
  814. line
  815. 4. next-line = line-number next-statement end-
  816. of-line
  817. 5. for-statement = FOR control-variable equals-sign
  818. initial-value TO limit (STEP
  819. increment)?
  820. 6. control-variable = simple-numeric-variable
  821. 7. initial-value = numeric-expression
  822. 8. limit = numeric-expression
  823. 9. increment = numeric-expression
  824. 10. next-statement = NEXT control-variable
  825. 13.3 _E_x_a_m_p_l_e_s
  826. FOR I = 1 TO 10 FOR I = A TO B STEP -1
  827. NEXT I NEXT I
  828. 13.4 _S_e_m_a_n_t_i_c_s
  829. The for-statement and the next-statement are defined in con-
  830. junction with each other. The physical sequence of statements
  831. beginning with a for-statement and continuing up to and in-
  832. cluding the first next-statement with the same control variable
  833. is termed a "for-block". For-blocks can be physically nested,
  834. i.e. one can contain another, but they shall not be interleaved,
  835. i.e. a for-block which contains a for-statement or a next-
  836. statement shall contain the entire for-block begun or ended by
  837. that statement.
  838. Furthermore, physically nested for-blocks shall not use the
  839. same control variable.
  840. - 18 -
  841. In the absence of a STEP clause in a for-statement, the incre-
  842. ment is assumed to be +1.
  843. The action of the for-statement and the next-statement is de-
  844. fined in terms of other statements, as follows:
  845. FOR v = initial-value TO limit STEP increment
  846. (block)
  847. NEXT v
  848. is equivalent to:
  849. LET own1 = limit
  850. LET own2 = increment
  851. LET v = initial-value
  852. line1 IF (v-own1) * SGN (own2) > 0 THEN line2
  853. (block)
  854. LET v = v + own2
  855. GOTO line1
  856. line2 REM continued in sequence
  857. Here v is any simple-numeric-variable, own1 and own2 are va-
  858. riables associated with the particular for-block and not ac-
  859. cessible to the programmer, and line1 and line2 are line-numbers
  860. associated with the particular for-block and not accessible to
  861. the programmer. The variables own1 and own2 are distinct from
  862. similar variables associated with other for-blocks. A program
  863. shall not transfer control into a for-body by any statement
  864. other than a return statement (see 12).
  865. 13.5 _E_x_c_e_p_t_i_o_n_s
  866. None.
  867. 13.6 _R_e_m_a_r_k_s
  868. Where arithmetic is approximate (as with decimal fractions in a
  869. binary machine), the loop will be executed within the limits of
  870. machine arithmetic. No presumptions about approximate achieve-
  871. ment of the end test are made. It is noted that in most ordinary
  872. situations where machine arithmetic is truncated (rather than
  873. rounded), such constructions as
  874. FOR X = 0 TO 1 STEP 0.1
  875. will work as the user expects, even though 0.1 is not represent-
  876. able exactly in a binary machine. If this is indeed the case,
  877. then the construction
  878. FOR X = 1 TO 0 STEP -0.1
  879. will probably not work as expected.
  880. As specified above, the value of the control-variable upon
  881. exit from a for-block via its next-statement is the first va-
  882. lue not used; if exit is via a control-statement, the control-
  883. variable retains the value it has when the control-statement
  884. is executed.
  885. The variables "own1" and "own2" associated with a for-block are
  886. assigned values only upon entry to the for-block through its
  887. for-statement.
  888. - 19 -
  889. 14. _P_R_I_N_T_ _S_T_A_T_E_M_E_N_T
  890. 14.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  891. The print-statement is designed for generation of tabular out-
  892. put in a consistent format.
  893. The general syntactic form of the print-statement is
  894. PRINT item p item p ... p item
  895. where each item is an expression, a tab-call, or null, and
  896. each punctuation mark p is either a comma or a semi-colon.
  897. 14.2 _S_y_n_t_a_x
  898. 1. print-statement = PRINT print-list?
  899. 2. print-list = (print-item? print-separator)*
  900. print_item?
  901. 3. print-item = expression / tab-call
  902. 4. tab-call = TAB left-parenthesis numeric-expres-
  903. sion right-parenthesis
  904. 5. print-separator = comma / semicolon
  905. 14.3 _E_x_a_m_p_l_e_s
  906. PRINT X PRINT "X EQUALS", 10
  907. PRINT X; (X+Z)/2 PRINT X, Y
  908. PRINT PRINT ,,,X
  909. PRINT TAB(10); A$; "IS DONE."
  910. 14.4 _S_e_m_a_n_t_i_c_s
  911. The execution of a print-statement generates a string of char-
  912. acters for transmission to an external device. This string of
  913. characters is determined by the successive evaluation of each
  914. print-item and print-separator in the print-list.
  915. Numeric-expressions shall be evaluated to produce a string of
  916. characters consisting of a leading space if the number is po-
  917. sitive or a leading minus-sign if the number is negative fol-
  918. lowed by the decimal representation of the absolute value of
  919. the number and a trailing space. The possible formats for the
  920. decimal representation of a number are the same as those des-
  921. cribed for numeric-constants in 6 and are used as follows.
  922. Each implementation shall define two quantities, a significance-
  923. width d to control the number of significant decimal digits
  924. printed in numeric representations, and an exrad-width e to con-
  925. trol the number of digits printed in the exrad component of a
  926. numeric representation. The value of d shall be at least six
  927. and the value of e shall be at least two.
  928. Each number that can be represented exactly as an integer with
  929. d or fewer decimal digits is output using the implicit point
  930. unscaled representation.
  931. All other numbers shall be output using either explicit point
  932. unscaled notation or explicit point scaled notation. Numbers
  933. which can be represented with d or fewer digits in the unscaled
  934. format no less accurately than they can be represented in the
  935. scaled format shall be output using the unscaled format. For
  936. example, if d = 6, then 10^(-6) is output as .000001 and
  937. - 20 -
  938. 10^(-7) is output as 1.E-7.
  939. Numbers represented in the explicit point unscaled notation shall
  940. be output with up to d significant decimal digits and a full-
  941. stop; trailing zeroes in the fractional part may be omitted.
  942. A number with magnitude less than 1 shall be represented with
  943. no digits to the left of the full-stop. This form requires up
  944. to d+3 characters counting the sign, the full-stop and the
  945. trailing space.
  946. Numbers represented in the explicit point scaled notation shall
  947. be output in the format
  948. significand E sign integer
  949. where the value x of the significand is in the range 1 <= x < 10
  950. and is to be represented with exactly d digits of precision, and
  951. where the exrad component has one to e digits. Trailing zeroes
  952. may be omitted in the fractional part of the significand and
  953. leading zeroes may be omitted from the exrad. This form re-
  954. quires up to d+e+5 characters counting the two signs, the full-
  955. stop, the "E" and a trailing space.
  956. String-expressions shall be evaluated to generate a string of
  957. characters.
  958. The evaluation of the semicolon separator shall generate the
  959. null string, i.e. a string of zero length.
  960. The evaluation of a tab-call or a comma separator depends upon
  961. the string of characters already generated by the current or
  962. previous print-statements. The "current line" is the (possibly
  963. empty) string of characters generated since the last end-of-
  964. line was generated. The "margin" is the number of characters,
  965. excluding the end-of-line character, that can be output on one
  966. line and is defined by the implementation. The "columnar posi-
  967. tion" of the current line is the print position that will be
  968. occupied by the next character output to that line; print posi-
  969. tions are numbered consecutively from the left, starting with
  970. position one.
  971. Each print-line is divided into a fixed number of print zones,
  972. where the number of zones and the length of each zone is im-
  973. plementation defined. All print zones, except possibly the last
  974. one on a line, shall have the same length. This length shall
  975. be at least d+e+6 characters in order to accommodate the print-
  976. ing of numbers in explicit point scaled notation as des-
  977. cribed above and to allow the comma separator to move the print-
  978. ing mechanism to the next zone as described below.
  979. The purpose of the tab-call is to set the columnar position of
  980. the current line to the specified value prior to printing the
  981. next print-item. More precisely, the argument of the tab-call
  982. is evaluated and rounded to the nearing integer n. IF n is less
  983. than one, an exception occurs. If n is greater than the margin
  984. m, then n is reduced by an integral multiple of m so that it
  985. is in the range 1 <= n <= m; i.e. n is set equal to
  986. - 21 -
  987. n - m * INT ((n-1)/m).
  988. If the columnar position of the current line is less than or
  989. equal to n, then spaces are generated, if necessary, to set the
  990. columnar position to n; if the columnar position of the current
  991. line is greater than n, then an end-of-line is generated follow-
  992. ed by enough spaces to set the columnar position of the new cur-
  993. rent line to n.
  994. The evaluation of the comma-separator generates one or more
  995. spaces to set the columnar position to the beginning of the
  996. next print zone, unless the current print zone is the last on
  997. the line, in which case an end-of-line is generated.
  998. If the print list does not end in a print-separator, then an
  999. end-of-line is generated and added to the characters generated
  1000. by the evaluation of the print-list.
  1001. If the evaluation of any print-item in a print-list would cause
  1002. the length of a nonempty line to exceed the margin, then an
  1003. end-of-line is generated prior to the characters generated by
  1004. that print-item. Subsequently, if the evaluation of a print-
  1005. item generates a string whose length is greater than the mar-
  1006. gin, then end-of-lines are inserted after every m characters
  1007. in the string, where m is the margin value.
  1008. 14.5 _E_x_c_e_p_t_i_o_n_s
  1009. The evaluation of a tab-call argument generates a value less
  1010. then one (nonfatal; the recommended recovery procedure is to
  1011. supply one and continue).
  1012. 14.6 _R_e_m_a_r_k_s
  1013. The comma-separator allows the programmer to tabulate the print-
  1014. ing mechanism to fixed tab settings at the end of each print
  1015. zone.
  1016. A completely empty print-list will generate an end-of-line,
  1017. thereby completing the current line of output. If this line
  1018. contained no characters, then a blank line results.
  1019. A print line on a typical terminal might be divided into five
  1020. print zones of fifteen print positions each.
  1021. 15. _I_N_P_U_T_ _S_T_A_T_E_M_E_N_T
  1022. 15.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1023. Input-statements provide for user interaction with a running
  1024. program by allowing variables to be assigned values that are
  1025. supplied by a user. The input-statement enables the entry of
  1026. mixed string and numeric data, with data items being separat-
  1027. ed by commas. The general syntactic form of the input-state-
  1028. ment is
  1029. INPUT variable, ..., variable
  1030. - 22 -
  1031. 15.2 _S_y_n_t_a_x
  1032. 1. input-statement = INPUT variable-list
  1033. 2. variable-list = variable (comma variable)*
  1034. 3. input-prompt = [implementation defined]
  1035. 4. input-reply = input-list end-of-line
  1036. 5. input-list = padded-datum (comma padded-datum)*
  1037. 6. padded-datum = space* datum space*
  1038. 7. datum = quoted-string / unquoted-string
  1039. 15.3 _E_x_a_m_p_l_e_s
  1040. INPUT X INPUT X, A$, Y(2) INPUT A, B, C
  1041. 3.14159 2,SMITH,-3 25,0,-15
  1042. 15.4 _S_e_m_a_n_t_i_c_s
  1043. An input-statement causes the variables in the variable-list
  1044. to be assigned, in order, values from the input-reply. In the
  1045. interactive mode, the user of the program is informed of the
  1046. need to supply data by the output of an input-prompt. In batch
  1047. mode, the input-reply is requested from the external source
  1048. by an implementation-defined means. Execution of the program
  1049. is suspended until a valid input-reply has been supplied.
  1050. The type of each datum in the input-reply shall correspond to
  1051. the type of the variable to which it is to be assigned; i.e.,
  1052. numeric-constants shall be supplied as input for numeric-
  1053. variables, and either quoted-strings or unquoted-strings shall
  1054. be supplied as input for string-variables. If the response to
  1055. input for a string-variable is an unquoted-string, leading
  1056. and trailing spaces shall be ignored (see 4).
  1057. If the evaluation of a numeric datum causes an underflow, then
  1058. its value shall be replaced by zero.
  1059. Subscript expressions in the variable-list are evaluated after
  1060. value have been assigned to the variables preceding them
  1061. (i.e. to the left of them) in the variable-list.
  1062. No assignment of values in the input-reply shall take place un-
  1063. til the input-reply has been validated with respect to the type
  1064. of each datum, the number of input items, and the allowable
  1065. range for each datum.
  1066. 15.5 _E_x_c_e_p_t_i_o_n_s
  1067. - The type of datum does not match the type of the variable to
  1068. which it is to be assigned (nonfatal, the recommended recov-
  1069. ery procedure is to request that the input-reply be re-sup-
  1070. plied).
  1071. - There is insufficient data in the input-list (nonfatal, the
  1072. recommended recovery procedure is to request that the input-
  1073. reply be resupplied).
  1074. - There is too much data in the input-list (nonfatal, the re-
  1075. commended recovery procedure is to request that the input-
  1076. reply be resupplied).
  1077. - 23 -
  1078. - The evaluation of a numeric datum causes an overflow (non-
  1079. fatal, the recommended recovery procedure is to request that
  1080. the input-reply be resupplied).
  1081. - A string datum contains too many characters (nonfatal, the
  1082. recommended recovery procedure is to request that the input-
  1083. reply be resupplied).
  1084. 15.6 _R_e_m_a_r_k_s
  1085. This Standard does not require an implementation to perform
  1086. any editing of the input-reply, though such editing may be per-
  1087. formed by the operating environment.
  1088. It is recommended that the input-prompt consists of a question-
  1089. mark followed by a single space.
  1090. This Standard does not require an implementation to output the
  1091. input-reply.
  1092. It is recommended that implementations report an underflow as
  1093. an exception and allow the input-reply to be resupplied.
  1094. 16. _R_E_A_D_ _A_N_D_ _R_E_S_T_O_R_E_ _S_T_A_T_E_M_E_N_T_S
  1095. 16.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1096. The read-statement provides for the assignment of values to
  1097. variables from a sequence of data created from data-statements
  1098. (see 17). The restore-statement allows the data in the program
  1099. to be reread. The general syntactic forms of the read and re-
  1100. store statements are
  1101. READ variable, ..., variable
  1102. RESTORE
  1103. 16.2 _S_y_n_t_a_x
  1104. 1. read-statement = READ variable-list
  1105. 2. restore-statement = RESTORE
  1106. 16.3 _E_x_a_m_p_l_e_s
  1107. READ X, Y, Z READ X(1), A$, C
  1108. 16.4 _S_e_m_a_n_t_i_c_s
  1109. The read-statement causes variables in the variable-list to be
  1110. assigned values, in order, from the sequence of data (see 17).
  1111. A conceptual pointer is associated with the data sequence. At
  1112. the initiation of execution of a program, this pointer points
  1113. to the first datum in the data sequence. Each time a read-state-
  1114. ment is executed, each variable in the variable-list in se-
  1115. quence is assigned the value of the datum indicated by the point-
  1116. er and the pointer is advanced to point beyond that datum.
  1117. The restore-statement resets the pointer for the data sequence
  1118. to the beginning of the sequence, so that the next read-state-
  1119. ment executed will read data from the beginning of the sequence
  1120. once again.
  1121. - 24 -
  1122. The type of a datum in the data sequence shall correspond to
  1123. the type of the variable to which it is to be assigned; i.e.,
  1124. numeric-variables require unquoted-strings which are numeric-
  1125. constants as data and string-variables require quoted-strings
  1126. or unquoted-strings as data. An unquoted-string which is a
  1127. valid numeric representation may be assigned to either a string-
  1128. variable or a numeric-variable by a read-statement.
  1129. If the evaluation of a numeric datum causes an underflow, then
  1130. its value shall be replaced by zero.
  1131. Subscript expressions in the variable-list are evaluated after
  1132. values have been assigned to the variables preceding them (i.e.
  1133. to the left of them) in the list.
  1134. 16.5 _E_x_c_e_p_t_i_o_n_s
  1135. - The variable-list in a read-statement requires more data than
  1136. are present in the remainder of the data-sequence (fatal).
  1137. - An attempt is made to assign a string datum to a numeric
  1138. variable (fatal).
  1139. - The evaluation of a numeric datum causes an overflow (non-
  1140. fatal, the recommended recovery procedure is to supply ma-
  1141. chine infinity with the appropriate sign and continue).
  1142. - A string datum contains too many characters (fatal).
  1143. 16.6 _R_e_m_a_r_k_s
  1144. It is recommended that implementations report an underflow as
  1145. exception and continue.
  1146. 17. _D_A_T_A_ _S_T_A_T_E_M_E_N_T
  1147. 17.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1148. The data-statement provides for the creation of a sequence of
  1149. representations for data elements for use by the read-statement.
  1150. The general syntactic form of the data-statement is
  1151. DATA datum, ..., datum
  1152. where each datum is either a numeric constant, a string-constant
  1153. or an unquoted string.
  1154. 17.2 _S_y_n_t_a_x
  1155. 1. data-statement = DATA data-list
  1156. 2. data-list = datum (comma datum)*
  1157. 17.3 _E_x_a_m_p_l_e_s
  1158. DATA 3.14159, PI, 5E-10, ","
  1159. 17.4 _S_e_m_a_n_t_i_c_s
  1160. Data from the totality of data-statements in the program are
  1161. collected into a single data sequence. The order in which data
  1162. appear textually in the totality of all data-statements deter-
  1163. mines the order of the data in the data sequence.
  1164. - 25 -
  1165. If the execution of a program reaches a line containing a
  1166. data-statement, then it shall proceed to the next line with
  1167. no other effect.
  1168. 17.5 _E_x_c_e_p_t_i_o_n_s
  1169. None.
  1170. 18. _A_R_R_A_Y_ _D_E_C_L_A_R_A_T_I_O_N_S
  1171. 18.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1172. The dimension-statement is used to reserve space for arrays.
  1173. Unless declared otherwise, all array subscripts shall have a
  1174. lower bound of zero and an upper bound of ten. Thus the default
  1175. space allocation reserves space for 11 elements in one-dimen-
  1176. sional arrays and 121 elements in two-dimensional arrays. By
  1177. use of a dimension-statement, the subscript(s) of an array may
  1178. be declared to have an upper bound other than ten. By use of
  1179. an option-statement, the subscripts of all arrays may be de-
  1180. clared to have a lower bound of one.
  1181. The general syntactic form of the dimension-statement is
  1182. DIM declaration, ..., declaration
  1183. where each declaration has the form
  1184. letter (integer)
  1185. or letter (integer , integer)
  1186. The general syntactic form of the option-statement is
  1187. OPTION BASE n
  1188. where n is either 0 or 1.
  1189. 18.2 _S_y_n_t_a_x
  1190. 1. dimension-statement = DIM array declaration
  1191. (comma array-declaration)*
  1192. 2. array-declaration = numeric-array-name left-parenthesis
  1193. bounds right-parenthesis
  1194. 3. bounds = integer (comma integer)?
  1195. 4. option-statement = OPTION BASE (0/1)
  1196. 18.3 _E_x_a_m_p_l_e_s
  1197. DIM A (6), B(10,10)
  1198. 18.4 _S_e_m_a_n_t_i_c_s
  1199. Each array-declaration occurring in a dimension-statement de-
  1200. clares the array named to be either one or two dimensional ac-
  1201. cording to whether one or two bounds are listed for the array.
  1202. In addition, the bounds specify the maximum values that sub-
  1203. script expressions for the array can have.
  1204. The declaration for an array, if present at all, shall occur in
  1205. a lower numbered line than any reference to an element of that
  1206. - 26 -
  1207. array. Arrays that are not declared in any dimension-statement
  1208. are declared implicitly to be one or two dimensional according
  1209. to their use in the program, and to have subscripts with a
  1210. maximum value of ten (see 7).
  1211. The option-statement declares the minimum value for all array
  1212. subscripts; if no option-statement occurs in a program, this
  1213. minimum is zero. An option-statement, if present at all, must
  1214. occur in a lower numbered line than any dimension-statement or
  1215. any reference to an element of an array. If an option-statement
  1216. specifies that the lower bound for array subscripts is one, then
  1217. no dimension-statement in the program may specify an upper bound
  1218. of zero. A program may contain at most one option-statement.
  1219. If the execution of a program reaches a line containing a di-
  1220. mension-statement or an option-statement, then it shall pro-
  1221. ceed to the next line with no other effect.
  1222. An array can be explicitly dimensioned only once.
  1223. 18.5 _E_x_c_e_p_t_i_o_n_s
  1224. None.
  1225. 19. _R_E_M_A_R_K_ _S_T_A_T_E_M_E_N_T
  1226. 19.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1227. The remark-statement allows program annotation.
  1228. 19.2 _S_y_n_t_a_x
  1229. 1. remark-statement = rem remark-string
  1230. 19.3 _E_x_a_m_p_l_e_s
  1231. REM FINAL CHECK
  1232. 19.4 _S_e_m_a_n_t_i_c_s
  1233. If the execution of a program reaches a line containing a
  1234. remark-statement, then it shall proceed to the next line with
  1235. no other effect.
  1236. 19.5 _E_x_c_e_p_t_i_o_n_s
  1237. None.
  1238. 20. _R_A_N_D_O_M_I_Z_E_ _S_T_A_T_E_M_E_N_T
  1239. 20.1 _G_e_n_e_r_a_l_ _D_e_s_c_r_i_p_t_i_o_n
  1240. The randomize-statement overrides the implementation-predefined
  1241. sequence of pseudo-random numbers as values for the RND func-
  1242. tion, allowing different (and unpredictable) sequences each
  1243. time a given program is executed.
  1244. 20.2 _S_y_n_t_a_x
  1245. 1. randomize-statement = RANDOMIZE
  1246. 20.3 _E_x_a_m_p_l_e_s
  1247. RANDOMIZE
  1248. - 27 -
  1249. 20.4 _S_e_m_a_n_t_i_c_s
  1250. Execution of the randomize-statement shall generate a new un-
  1251. predictable starting point for the list of pseudo-random num-
  1252. bers used by the RND function (see 9).
  1253. 20.5 _E_x_c_e_p_t_i_o_n_s
  1254. None.
  1255. 20.6 _R_e_m_a_r_k_s
  1256. In the case of implementations which do not have access to a
  1257. randomizing device such as a real-time clock, the randomize-
  1258. statement may be implemented by means of an interaction with
  1259. the user.
  1260. - 28 -
  1261. +---------------------------------------+---------------+
  1262. | NAME | GRAPHIC |
  1263. +---------------------------------------+---------------+
  1264. | | |
  1265. | Space | |
  1266. | Exclamation-mark | ! |
  1267. | Quotation-mark | " |
  1268. | Number-sign | # |
  1269. | Dollar-sign | $ |
  1270. | Percent-sign | % |
  1271. | Ampersand | & |
  1272. | Apostrophe | ' |
  1273. | Left-parenthesis | ( |
  1274. | Right-parenthesis | ) |
  1275. | Asterisk | * |
  1276. | Plus-sign | + |
  1277. | Comma | , |
  1278. | Minus-sign | - |
  1279. | Full-stop | . |
  1280. | Solidus | / |
  1281. | Digits | 0 - 9 |
  1282. | Colon | : |
  1283. | Semi-colon | ; |
  1284. | Less-than-sign | < |
  1285. | Equals-sign | = |
  1286. | Greater-than-sign | > |
  1287. | Question-mark | ? |
  1288. | Letters | A - Z |
  1289. | Circumflex-accent | ^ |
  1290. | Underline | _ |
  1291. +---------------------------------------+---------------+
  1292. TABLE 1
  1293. - 29 -
  1294. +---+---+---+---+---+---+---+---+
  1295. b|0 |0 |0 |0 |1 |1 |1 |1 |
  1296. +---+---+---+---+---+---+---+---+
  1297. b| 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
  1298. +---+---+---+---+---+---+---+---+
  1299. b b b b b| 0| 1| 0| 1| 0| 1| 0| 1|
  1300. +-+-+-+-+ +---+---+---+---+---+---+---+---+
  1301. |0|0|0|0| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
  1302. +=+=+=+=+====+===+===+===+===+===+===+===+===+
  1303. |0|0|0|0| 0 |NUL|DLE| SP| 0 | @ | P | ` | p |
  1304. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1305. |0|0|0|1| 1 |SOH|DC1| ! | 1 | A | Q | a | q |
  1306. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1307. |0|0|1|0| 2 |STX|DC2| " | 2 | B | R | b | r |
  1308. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1309. |0|0|1|1| 3 |ETX|DC3| # | 3 | C | S | c | s |
  1310. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1311. |0|1|0|0| 4 |EDT|DC4| $ | 4 | D | T | d | t |
  1312. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1313. |0|1|0|1| 5 |ENQ|NAK| % | 5 | E | U | e | u |
  1314. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1315. |0|1|1|0| 6 |ACK|SYN| & | 6 | F | V | f | v |
  1316. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1317. |0|1|1|1| 7 |BEL|ETB| ' | 7 | G | W | g | w |
  1318. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1319. |1|0|0|0| 8 | BS|CAN| ( | 8 | H | X | h | x |
  1320. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1321. |1|0|0|1| 9 | HT| EM| ) | 9 | I | Y | i | y |
  1322. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1323. |1|0|1|0| 10 | LF|SUB| * | : | J | Z | j | z |
  1324. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1325. |1|0|1|1| 11 | VT|ESC| + | ; | K | [ | k | { |
  1326. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1327. |1|1|0|0| 12 | FF| FS| , | < | L | \ | l | | |
  1328. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1329. |1|1|0|1| 13 | CR| GS| - | = | M | ] | m | } |
  1330. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1331. |1|1|1|0| 14 | SO| RS| . | > | N | ^ | n | ~ |
  1332. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1333. |1|1|1|1| 15 | SI| US| / | ? | O | _ | o |DEL|
  1334. +-+-+-+-+----+---+---+---+---+---+---+---+---+
  1335. TABLE 2
  1336. NOTE: In the 7-bit and in the 8-bit code tables two characters
  1337. are allocated to pos. 2/4, namely $ and box. In any version
  1338. of the codes a single character is to be allocated to this
  1339. position. The character of the 7-bit or of the 8-bit coded
  1340. character set, which corresponds to the character $ of the
  1341. Minimal BASIC character set is either $ or box (box in the
  1342. International Reference Version).
  1343. The same applies to pos. 2/3 for the characters £ and #,
  1344. the latter being the character of the International Refer-
  1345. ence version.
  1346. - 30 -
  1347. _A_P_P_E_N_D_I_X_ _1
  1348. Organization of the Standard
  1349. ----------------------------
  1350. This Standard is organized into a number of sections, each of which
  1351. covers a particular feature of BASIC. Sections 4 to 20 are divided
  1352. into sub-sections, as follows.
  1353. Sub-section 1. General Description
  1354. This sub-section briefly describes the features of BASIC to be treat-
  1355. ed and indicates the general syntactic form of these features.
  1356. Sub-section 2. Syntax
  1357. The exact syntax of features of the language is described in a modi-
  1358. fied context-free grammar or Backus-Naur Form. The details of this
  1359. method of syntax specification are described in Appendix 2.
  1360. In order to keep the syntax reasonably simple the syntax specifica-
  1361. tion will allow it to describe some constructions which, strictly
  1362. speaking, are not legal according to this Standard, e.g. it will
  1363. allow the generation of the statement
  1364. 100 LET X = A(1) + A(1,2)
  1365. in which the array A occurs with differing numbers of subscripts.
  1366. Rather than ruling such constructions out by a more complicated syn-
  1367. tax, this Standard shall instead rule them out in the semantics.
  1368. Sub-section 3. Examples
  1369. A short list of valid examples that can be generated by certain of
  1370. the syntax equations in sub-section 2 is given.
  1371. Sub-section 4. Semantics
  1372. The semantic rules in this Standard serve two purposes. First, they
  1373. rule out certain constructions which are permitted by the syntax,
  1374. but which have no valid meaning according to this Standard. Second,
  1375. they assign a meaning to the remaining constructions.
  1376. Sub-section 5. Exceptions
  1377. An exception occurs when an implementation recognizes that a program
  1378. may not perform or is not performing in accordance with this Standard.
  1379. All exceptions described in this section shall be reported unless
  1380. some mechanism is provided in an enhancement to this Standard that
  1381. has been invoked by the user to handle exceptions.
  1382. Where indicated, certain exceptions may be handled by the specified
  1383. procedures; if no procedure is given, or if restrictions imposed by
  1384. - 31 -
  1385. the hardware or the operating environment make it impossible to
  1386. follow the given procedures, then the exception must be handled by
  1387. terminating the program. Enhancements to this Standard may describe
  1388. mechanisms for controlling the manner in which exceptions are re-
  1389. ported and handled, but no such mechanisms are specified in this
  1390. Standard.
  1391. This Standard does not specify an order in which exceptions shall
  1392. be detected or processed.
  1393. Sub-section 6. Remarks
  1394. This sub-section contains remarks which point out certain features
  1395. of this Standard as well as remarks which make recommendations con-
  1396. cerning the implementation of a BASIC language processor in an oper-
  1397. ating environment.
  1398. - 32 -
  1399. _A_P_P_E_N_D_I_X_ _2
  1400. Method of Syntax Specification
  1401. ------------------------------
  1402. The syntax, through a series of rewriting rules known as "product-
  1403. ions", defines syntactic objects of various types, such as "program"
  1404. or "expression", and describes which strings of symbols are objects
  1405. of these types.
  1406. In the syntax, upper-case letters, digits, and (possibly hyphenated)
  1407. lower-case words are used as "metanames", i.e. as names of syntactic
  1408. objects. Most of these metanames are defined by rewriting rules in
  1409. terms of other metanames. In order that this process terminate, cer-
  1410. tain metanames are designated as "terminal" metanames, and rewriting
  1411. rules for them are not included in the syntax. All terminal metanames
  1412. occur for the first time and are defined in Section 4. It should be
  1413. noted in particular that all upper-case letters are terminal meta-
  1414. names which denote themselves.
  1415. We illustrate further details of the syntax by considering some ex-
  1416. amples. In Section 12 we find the production
  1417. gosub-statement = GO space* SUB line-number
  1418. which indicates that a "gosub-statement" consists of the letters G,
  1419. O, any number of spaces, S, U, and B followed by a line number.
  1420. What is a "line-number"? In Section 5, the production
  1421. line-number = digit digit? digit? digit?
  1422. indicates that a "line-number" is a "digit" followed by up to three
  1423. other "digits" (the question mark is a syntactic operator indicating
  1424. that the object it follows may or may not be present).
  1425. What is a "digit"? In Section 4, the production
  1426. digit = 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9
  1427. indicates that a "digit" is either a "0", a "1", ... or a "9" (the
  1428. solidus is a syntactic operator meaning "or" and is used to indicate
  1429. that a metaname can be rewritten in one of several ways). Since the
  1430. digits are terminal metanames (i.e. they do not occur on the left-
  1431. hand side of any production), our decipherment of the syntax for the
  1432. "gosub-statement" comes to an end. The semantics in Section 4 iden-
  1433. tify the digits in terms of the characters they represent.
  1434. An asterisk is a syntactic operator like the question-mark, and it
  1435. indicates that the object it follows may occur any number of times,
  1436. including zero times, in the production.
  1437. For example
  1438. integer = digit digit*
  1439. indicates than an "integer" is a "digit" followed by an arbitrary
  1440. - 33 -
  1441. number of other "digits".
  1442. Parentheses may be used to group sequences of metanames together.
  1443. For example
  1444. variable-list = variable (comma variable)*
  1445. defines a "variable-list" to consist of a "variable" followed by an
  1446. arbitrary number of other "variables" separated by "commas".
  1447. When several syntactic operators occur in the same production, the
  1448. operators "?" and "*" take precedence over the operator "/".
  1449. Spaces in the syntax are used to separate hyphenated lower-case words
  1450. from each other. Special conventions are observed regarding spaces
  1451. in BASIC programs (see Section 5). The syntax as described generates
  1452. programs which contain no spaces other than those occurring in re-
  1453. marks, in certain string constants, or where the presence of a space
  1454. is explicitly indicated by the metaname "space".
  1455. Additional spaces may be inserted to improve readability provided
  1456. that the restrictions imposed in Section 5 are observed.
  1457. - 34 -
  1458. _A_P_P_E_N_D_I_X_ _3
  1459. _C_o_n_f_o_r_m_a_n_c_e
  1460. There are two aspects of conformance to this language Standard :
  1461. conformance by a program written in the language, and conformance
  1462. by an implementation which processes such programs.
  1463. A program is said to conform to this Standard only when
  1464. - each statement contained therein is a syntactically valid instance
  1465. of a statement specified in this Standard,
  1466. - each statement has an explicitly valid meaning specified herein,
  1467. and
  1468. - the totality of statements compose an instance of a valid program
  1469. which has an explicitly valid meaning specified herein.
  1470. An implementation is said to conform to this Standard only when
  1471. - it accepts and processes programs conforming to this Standard,
  1472. - it reports reasons for rejecting any program which does not conform
  1473. to this Standard,
  1474. - it interprets errors and exceptional circumstances according to the
  1475. specifications of this Standard,
  1476. - its interpretation of the semantics of each statement of a stand-
  1477. ard-conforming program conforms to the specification in this
  1478. Standard.
  1479. - its interpretation of the semantics of a standard-conforming pro-
  1480. gram as a whole conforms to the specifications in this Standard,
  1481. - it accepts as input, manipulates, and can generate as output numbers
  1482. of at least the precision and range specified in this Standard, and
  1483. - it is accompanied by a reference manual which clearly defines the
  1484. actions taken in regard to features which are called "undefined"
  1485. or "implementation-defined" in this Standard.
  1486. This Standard does not include requirements for reporting specific
  1487. syntactic errors in the text of a program. Implementations conforming
  1488. to this Standard my accept programs written in an enhanced language
  1489. without having to report all constructs not conforming to this Stand-
  1490. ard. However, whenever a statement or other program element does not
  1491. conform to the syntactic rules given herein, either an error shall
  1492. be reported or the statement or other program element shall have an
  1493. implementation-defined meaning.
  1494. - 35 -
  1495. _A_P_P_E_N_D_I_X_ _4
  1496. Implementation-defined Features
  1497. -------------------------------
  1498. A number of the features defined in this Standard have been left
  1499. for definition by the implementor. However, this will not affect
  1500. portability, provided that the limits recommended in the various
  1501. sections are respected. The way these features are implemented
  1502. shall be defined in the user- or system-manual of the specific
  1503. implementation.
  1504. The following is a list of implementation-defined features:
  1505. - accuracy of evaluation of numeric expressions (see 8)
  1506. - end-of-line (see 5, 14 and 15)
  1507. - exrad-width for printing numeric representations (see 14)
  1508. - initial value of variables (see 7)
  1509. - input-prompt (see 15)
  1510. - longest string that can be retained (see 11)
  1511. - value of machine infinitesimal (see 6)
  1512. - value of machine infinity (see 6)
  1513. - margin for output lines (see 14)
  1514. - precision for numeric values (see 6)
  1515. - print-zone length (see 14)
  1516. - pseudo-random number sequence (see 9 and 20)
  1517. - significance width for printing numeric representations (see 15)
  1518. - means of requesting the input-reply in batch mode (see 15)