|
|
1.1 root 1: .pa 1
2: .he 'BAS (I)'1/15/73'BAS (I)'
3: .ti 0
4: NAME bas -- basic
5: .sp
6: .ti 0
7: SYNOPSIS bas___ [ file ]
8: .sp
9: .ti 0
10: DESCRIPTION bas___
11: is a dialect of basic [1].
12: If a file argument is provided,
13: the file is used for input before the console
14: is read.
15: .sp
16: bas___ accepts lines of the form:
17: .sp
18: statement
19: integer statement
20: .sp
21: Integer numbered statements
22: (known as internal statements)
23: are stored for later execution.
24: They are stored in sorted ascending order.
25: Non-numbered statements are immediately executed.
26: The result of an immediate expression statement
27: (that does not have '=' as its highest operator) is printed.
28: .sp
29: Statements have the following syntax:
30: .sp
31: .in +6
32: .ti -3
33: expression
34: .br
35: The expression is executed for its side
36: effects (assignment or function call)
37: or for printing as described above.
38: .sp
39: .ti -3
40: done____
41: .br
42: Return to system level.
43: .sp
44: .ti -3
45: draw____ expression expression expression
46: .br
47: A line is drawn on the Tektronix 611 display (/dev/vt0) from
48: the current display position
49: to the XY co-ordinates specified by the
50: first two expressions.
51: (The scale is zero to one in both X and Y directions)
52: If the third expression
53: is zero, the line is invisible.
54: The current display position is set to the end point.
55: .sp
56: .ti -3
57: display_______ list
58: .br
59: The list of expressions and strings is
60: concatenated and displayed (i.e. printed) on the 611 starting
61: at the current display position.
62: The current display position is not changed.
63: .sp
64: .ti -3
65: erase_____
66: .br
67: The 611 screen is erased.
68: .sp
69: .ti -3
70: for___ name =_= expression expression statement
71: .ti -3
72: for___ name =_ expression expression
73: .br
74: .li
75: ...
76: .ti -3
77: next____
78: .br
79: The for___ statement
80: repetitively executes a
81: statement (first form)
82: or a group of statements (second form)
83: under control of a named variable.
84: The variable takes on the value of
85: the first expression,
86: then is incremented by one on each loop,
87: not to exceed the value of
88: the second expression.
89: .sp
90: .ti -3
91: goto____ expression
92: .br
93: The expression is evaluated, truncated to an integer
94: and execution goes to the corresponding integer numbered statment.
95: If executed from immediate mode,
96: the internal statements are compiled first.
97: .sp
98: .ti -3
99: if__ expression statement
100: .br
101: The statement is executed if the expression evaluates
102: to non-zero.
103: .sp
104: .ti -3
105: list____ [expression [expression]]
106: .br
107: list____ is used to print out the stored internal statements.
108: If no arguments are given, all internal statements are printed.
109: If one argument is given, only that
110: internal statement is listed.
111: If two arguments are given, all internal statements
112: inclusively between the arguments are printed.
113: .sp
114: .ti -3
115: print_____ list
116: .br
117: The list of expressions and strings are concatenated and
118: printed.
119: (A string is delimited by " characters.)
120: .sp
121: .ti -3
122: return______ [expression]
123: .br
124: The expression is evaluated and the result is passed
125: back as the value of a function call.
126: If no expression is given, zero is returned.
127: .sp
128: .ti -3
129: run___
130: .br
131: The internal statements are compiled.
132: The symbol table is re-initialized.
133: The random number generator is re-set.
134: Control is passed to the lowest numbered internal
135: statement.
136: .sp
137: .ti -6
138: Expressions have the following syntax:
139: .sp
140: .ti -3
141: name
142: .br
143: A name is used to specify a variable.
144: Names are composed of a letter ('a' - 'z')
145: followed by letters and digits.
146: The first four characters of a name are significant.
147: .sp
148: .ti -3
149: number
150: .br
151: A number is used to represent a constant value.
152: A number is composed of digits, at most one decimal point ('.')
153: and possibly a scale factor of the form
154: e_ digits or e-__ digits.
155: .sp
156: .ti -3
157: (_ expression )_
158: .br
159: Parentheses are used to alter normal order of evaluation.
160: .sp
161: .ti -3
162: expression operator expression
163: .br
164: Common functions of two arguments are abbreviated
165: by the two arguments separated by an operator denoting the function.
166: A complete list of operators is given below.
167: .sp
168: .ti -3
169: expression (_ [expression [,_ expression ...]] )_
170: .br
171: Functions of an arbitrary number of arguments
172: can be called by an expression followed by the arguments
173: in parentheses separated by commas.
174: The expression evaluates to the
175: line number of the entry of the function in the
176: internally stored statements.
177: This causes the internal statements to be compiled.
178: If the expression evaluates negative,
179: a builtin function is called.
180: The list of builtin functions appears below.
181: .sp
182: .ti -3
183: name [_ expression [,_ expression ...] ]_
184: .br
185: Each expression is truncated to an integer
186: and used as a specifier for the name.
187: The result is syntactically identical to a name.
188: a[1,2] is the same as a[1][2].
189: The truncated expressions are restricted to
190: values between 0 and 32767.
191: .sp
192: .ti -6
193: The following is the list of operators:
194: .sp
195: .ti -3
196: =
197: .br
198: = is the assignment operator.
199: The left operand must be a name or an array element.
200: The result is the right operand.
201: Assignment binds right to left,
202: all other operators bind left to right.
203: .sp
204: .ti -3
205: & |
206: .br
207: &_ (logical and)
208: has result zero if either of its arguments are zero.
209: It has result one if both its arguments are non-zero.
210: |_ (logical or)
211: has result zero if both of its arguments are zero.
212: It has result one if either of its arguments are non-zero.
213: .sp
214: .ti -3
215: < <= > >= == <>
216: .br
217: The relational operators
218: (< less than, <= less than or equal,
219: > greater than,
220: >= greater than or equal,
221: == equal to,
222: <> not equal to)
223: return one if their arguments are in the specified
224: relation.
225: They return zero otherwise.
226: Relational operators at the same level extend as follows:
227: a>b>c is the same as a>b&b>c.
228: .sp
229: .ti -3
230: + -
231: .br
232: Add and subtract.
233: .sp
234: .ti -3
235: * /
236: .br
237: Multiply and divide.
238: .sp
239: .ti -3
240: ^
241: .br
242: Exponentiation.
243: .sp
244: .ti -6
245: The following is a list of builtin functions:
246: .sp
247: .ti -3
248: arg
249: .br
250: Arg(i) is the value of the i_th
251: actual parameter on the current level
252: of function call.
253: .sp
254: .ti -3
255: exp
256: .br
257: Exp(x) is the exponential function of x.
258: .sp
259: .ti -3
260: log
261: .br
262: Log(x) is the logarithm base e of x.
263: .sp
264: .ti -3
265: sin
266: .br
267: Sin(x) is the sine of x (radians).
268: .sp
269: .ti -3
270: cos
271: .br
272: Cos(x) is the cosine of x (radians).
273: .sp
274: .ti -3
275: atn
276: .br
277: Atn(x) is the arctangent of x.
278: .sp
279: .ti -3
280: rnd
281: .br
282: Rnd() is a uniformly distributed random
283: number between zero and one.
284: .sp
285: .ti -3
286: expr
287: .br
288: Expr() is the only form of program input.
289: A line is read from the input and
290: evaluated as an expression.
291: The resultant value is returned.
292: .sp
293: .ti -3
294: int
295: .br
296: Int(x) returns x truncated to an integer.
297: .in -6
298: .sp
299: .ti 0
300: FILES /tmp/btm? temporary
301: .sp
302: .ti 0
303: SEE ALSO [1] DEC-11-AJPB-D
304: .sp
305: .ti 0
306: DIAGNOSTICS Syntax
307: errors cause the incorrect line to be typed
308: with an underscore where the parse failed.
309: All other diagnostics are self explanatory.
310: .sp
311: .ti 0
312: BUGS --
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.