1aime(1)                     General Commands Manual                    aime(1)
2
3
4

NAME

6       aime - interpret programs
7

SYNOPSIS

9       aime [OPTIONS] PROGRAM [TYPE NAME VALUE]...
10

DESCRIPTION

12       aime  executes PROGRAM.  The TYPE NAME VALUE definitions introduce pro‐
13       gram accessible constants.  TYPE may be one of cardinal (integral, pos‐
14       itive), integer (integral), real (real) and text (string).
15

OPTIONS

17       -B, --reference-bail-out DUE
18              Stop  reference  tracing when determining reachability after DUE
19              examined links.  The determination is  attempted  every  time  a
20              reference  is  removed.   The  objects  deemed  unreachable  are
21              destroyed.  The objects for which the  determination  cannot  be
22              made in DUE reference examinations are recorded and their reach‐
23              ability status is determined later in a consolidated fashion.  A
24              zero  value  for  DUE  instructs  aime to make the determination
25              right away and no matter how many links need to be examined.   A
26              non  zero  value makes the transition from proper immediate dis‐
27              posal to consolidated disposal.  The default value for DUE is 4.
28
29       -D, --reference-bail-set SET
30              Clear bailed out references when they are SET many (the  reacha‐
31              bility  of objects recorded for later determination is triggered
32              when their number reaches SET).
33
34       -S, --initial INDEX
35              Start numbering lines when error reporting from INDEX.   Default
36              is 1.
37
38       -W, --cpp COMMAND
39              Set  source preprocessing command to COMMAND.  The command reads
40              the standard input and  writes  standard  output.   The  default
41              value  is  cpp.  Alternatives known to work include gcc -E - and
42              mcpp.
43
44       -a     Make program arguments available as argc() /  argv()  /  args().
45              The program arguments will not be interpreted as TYPE NAME VALUE
46              triplets.  See MISCELLANEOUS FUNCTIONS for more information.
47
48       -c     Execute the PROGRAM program instead the program  read  from  the
49              PROGRAM file.
50
51       -f, --framed
52              Expand  function  calls  in a hierarchical fashion.  Faster than
53              the default sequenced execution, the stack based execution  can‐
54              not execute programs if the call stack gets too deep.
55
56       -p, --preprocess
57              Run source through the C preprocessor.
58
59              Comments  in preprocessed sources should follow the preprocessor
60              comment syntax.
61
62              Source preprocessing is as of yet experimental.  The  preproces‐
63              sor error messages are dissimilar to the aime error messages.
64
65       -s, --sequenced
66              Execute  program  step  by  step, flattening the call hierarchy.
67              Slightly slower than the stack based  execution,  the  sequenced
68              execution can execute programs no matter how deep the call stack
69              gets.  Default.
70
71       --ignore-child-exits
72              Do not fail when child processes exit with a code other than  0.
73              Does  not  apply  to processes waited via aime library routines,
74              like xs_spend.
75
76       --list List available functions and exit with a status code  indicating
77              success.
78
79       --help Print  a  usage  message  and exit with a status code indicating
80              success.
81
82       --version
83              Print version information on standard output then exit.
84

PROGRAM SYNTAX

86       The interpreted syntax is much resembling the C syntax.  It allows  for
87       prefix  unary  and  common syntax binary operators, functions and vari‐
88       ables.  The supported types include the immediate  cardinal  (integral,
89       positive), integer (integral), real (real) and text (string), along the
90       referable data (byte array), date (calendar date),  file  (UNIX  file),
91       list (heterogenous sequence), record (string key heterogenous associate
92       table), time (duration), etc.  void is allowed for function type.
93
94       The C if, else, while, do while and  break  statements  are  supported,
95       their  syntax  and  semantics  being  pretty much the same as in C.  An
96       extra elif statement is borrowed from the C preprocessor, yet its  syn‐
97       tax  is  C  inspired.   The for statement is for collection traversals,
98       with its first iterator variable always indicating the position and the
99       optional  second  the  data  in that position.  The opening and closing
100       block braces are mandatory.  The declarations must  precede  statements
101       within a block.  The variable initialization is disallowed.
102
103       A more formal syntax definition is:
104
105       program: block
106
107       block: declarations_section statements_section
108
109       declarations_section:
110              | declarations_line declarations_section
111
112       declarations_line: type name subsequent_name ;
113
114       subsequent_name:
115              | , name subsequent_name
116
117       statements_section:
118              | statement_line statements_section
119
120       statement_line: ;
121              | expression ;
122              | do { break_block } while ( expression ) ;
123              | if ( expression ) { block } elif_block_list else_block
124              | for ( variable1 [variable2] in collection ) { break_block }
125              | while ( expression ) { break_block }
126
127       elif_block_list:
128              | elif_block elif_block_list
129
130       elif_block: elif ( expression ) { block }
131
132       else_block:
133              | else { block }
134
135       collection: expression
136
137       break_block: declarations_section break_statements_section
138
139       break_statements_section:
140              | break_statement_line break_statements_section
141
142       break_statement_line: break ;
143              | statement_line
144
145       Functions  and variables do not share the same name space, thus using a
146       function name for a variable is allowed.  The break, do, elif, if, else
147       and  while keywords and the cardinal, integer, real and text type names
148       are however restricted for variable naming.
149
150       The expression syntax is much resembling the C expression syntax.
151
152       Most of prefix unary and common syntax binary C operators are supported
153       (including  unary !, +, - and ~ and binary *, /, %, +, -, <<, >>, <, >,
154       <=, >=, !=, ==, &, ^, |, &&, ||, =, +=, -=, *=, /=, %=, &=, ^=, |=, <<=
155       and  >>=), the semantics and precedence being the same or at least very
156       close to those of their C counterparts.
157
158       A secondary syntax allows for functions.  Function definition syntax is
159       much  the  C syntax.  One main function, returning integer and having a
160       void argument list, is expected.
161
162       The formal syntax definition is:
163
164       program: function subsequent_function
165
166       function: definition
167              | declaration
168
169       definition: void name ( arguments_list ) { block }
170              | type_other_than_void name ( arguments_list ) { block_return }
171
172       arguments_list: void
173              | ...
174              | argument subsequent_argument
175              | argument subsequent_argument , ...
176
177       argument: type reference_class name
178
179       block_return: block return expression ;
180
181       declaration: type name ( positions_list ) ;
182
183       positions_list: void
184              | ...
185              | position subsequent_position
186              | position subsequent_position , ...
187
188       position: type reference_class
189              | type reference_class name
190
191       reference_class:
192              | &
193
194       subsequent_position:
195              | , position subsequent_position
196
197       subsequent_argument:
198              | , argument subsequent_argument
199
200       subsequent_function:
201              | function subsequent_function
202
203       Functions may return no value, integer and real only (i.e.  the  return
204       type of functions may only be one of cardinal, integer, real and void).
205

OUTPUT FUNCTIONS

207       Standard output formatting functions include:
208
209       void o_byte(integer c);
210              outputs the c code character
211
212       void o_flush(void);
213              flushes standard output
214
215       void o_integer(integer m);
216              outputs m
217
218       void o_real(integer d, real x);
219              outputs  x  with  no more than d digits if d is not less than 0,
220              does nothing otherwise
221
222       void o_text(text s);
223              outputs s
224

ERROR FUNCTIONS

226       Standard error formatting functions include:
227
228       void v_byte(integer c);
229              outputs the c code character
230
231       void v_flush(void);
232              flushes standard error
233
234       void v_integer(integer m);
235              outputs m
236
237       void v_real(integer d, real x);
238              outputs x with no more than d digits if d is not  less  than  0,
239              does nothing otherwise
240
241       void v_text(text s);
242              outputs s
243

MISCELLANEOUS FUNCTIONS

245       Interpreter specific functions:
246
247       integer argc(void);
248              is the number of program arguments.
249
250       text argv(integer i);
251              is the i indexed program argument, the name of the program being
252              the first.  Negative indices are interpreted with respect to the
253              end of arguments list.
254
255       list args(integer i);
256              is  a  new  list  of  the program arguments, starting with the i
257              indexed one.  A 0 i gives all the arguments, including the  pro‐
258              gram name.  A 1 i has the latter skipped.
259
260       void exit(integer e);
261              terminates program execution, tells aime to exit e.
262
263       The   argc(),  argv(),  args()  functions  are  only  available  if  so
264       requested, via the -a option.
265

MISCELLANEA

267       aime waits for the child processes started through the process library,
268       etc.
269

RETURN VALUE

271       aime  returns  non zero for non successful program execution.  For suc‐
272       cessful program execution aime returns the value of the  exit  argument
273       if  exit  was  called,   the return of main for procedural programs and
274       zero for non procedural programs otherwise.
275

SEE ALSO

277       cpp(1), express17(1), gcc(1), mcpp(1)
278

AUTHORS

280       Ciprian Niculescu
281
282
283
284                                   May 2019                            aime(1)
Impressum