| 1 |
(* decl.def declaration nodes used to create the AST. |
| 2 |
|
| 3 |
Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. *) |
| 21 |
|
| 22 |
DEFINITION MODULE decl ; (*!m2pim*) |
| 23 |
|
| 24 |
FROM nameKey IMPORT Name ; |
| 25 |
FROM symbolKey IMPORT performOperation ; |
| 26 |
FROM mcReserved IMPORT toktype ; |
| 27 |
FROM mcComment IMPORT commentDesc ; |
| 28 |
|
| 29 |
TYPE |
| 30 |
node ; |
| 31 |
isNodeF = PROCEDURE (node) : BOOLEAN ; |
| 32 |
|
| 33 |
|
| 34 |
(* |
| 35 |
getDeclaredMod - returns the token number associated with the nodes declaration |
| 36 |
in the implementation or program module. |
| 37 |
*) |
| 38 |
|
| 39 |
PROCEDURE getDeclaredMod (n: node) : CARDINAL ; |
| 40 |
|
| 41 |
|
| 42 |
(* |
| 43 |
getDeclaredDef - returns the token number associated with the nodes declaration |
| 44 |
in the definition module. |
| 45 |
*) |
| 46 |
|
| 47 |
PROCEDURE getDeclaredDef (n: node) : CARDINAL ; |
| 48 |
|
| 49 |
|
| 50 |
(* |
| 51 |
getFirstUsed - returns the token number associated with the first use of |
| 52 |
node, n. |
| 53 |
*) |
| 54 |
|
| 55 |
PROCEDURE getFirstUsed (n: node) : CARDINAL ; |
| 56 |
|
| 57 |
|
| 58 |
(* |
| 59 |
isDef - return TRUE if node, n, is a definition module. |
| 60 |
*) |
| 61 |
|
| 62 |
PROCEDURE isDef (n: node) : BOOLEAN ; |
| 63 |
|
| 64 |
|
| 65 |
(* |
| 66 |
isImp - return TRUE if node, n, is an implementation module. |
| 67 |
*) |
| 68 |
|
| 69 |
PROCEDURE isImp (n: node) : BOOLEAN ; |
| 70 |
|
| 71 |
|
| 72 |
(* |
| 73 |
isImpOrModule - returns TRUE if, n, is a program module or implementation module. |
| 74 |
*) |
| 75 |
|
| 76 |
PROCEDURE isImpOrModule (n: node) : BOOLEAN ; |
| 77 |
|
| 78 |
|
| 79 |
(* |
| 80 |
isVisited - returns TRUE if the node was visited. |
| 81 |
*) |
| 82 |
|
| 83 |
PROCEDURE isVisited (n: node) : BOOLEAN ; |
| 84 |
|
| 85 |
|
| 86 |
(* |
| 87 |
unsetVisited - unset the visited flag on a def/imp/module node. |
| 88 |
*) |
| 89 |
|
| 90 |
PROCEDURE unsetVisited (n: node) ; |
| 91 |
|
| 92 |
|
| 93 |
(* |
| 94 |
setVisited - set the visited flag on a def/imp/module node. |
| 95 |
*) |
| 96 |
|
| 97 |
PROCEDURE setVisited (n: node) ; |
| 98 |
|
| 99 |
|
| 100 |
(* |
| 101 |
setEnumsComplete - sets the field inside the def or imp or module, n. |
| 102 |
*) |
| 103 |
|
| 104 |
PROCEDURE setEnumsComplete (n: node) ; |
| 105 |
|
| 106 |
|
| 107 |
(* |
| 108 |
getEnumsComplete - gets the field from the def or imp or module, n. |
| 109 |
*) |
| 110 |
|
| 111 |
PROCEDURE getEnumsComplete (n: node) : BOOLEAN ; |
| 112 |
|
| 113 |
|
| 114 |
(* |
| 115 |
resetEnumPos - resets the index into the saved list of enums inside |
| 116 |
module, n. |
| 117 |
*) |
| 118 |
|
| 119 |
PROCEDURE resetEnumPos (n: node) ; |
| 120 |
|
| 121 |
|
| 122 |
(* |
| 123 |
getNextEnum - returns the next enumeration node. |
| 124 |
*) |
| 125 |
|
| 126 |
PROCEDURE getNextEnum () : node ; |
| 127 |
|
| 128 |
|
| 129 |
(* |
| 130 |
isModule - return TRUE if node, n, is a program module. |
| 131 |
*) |
| 132 |
|
| 133 |
PROCEDURE isModule (n: node) : BOOLEAN ; |
| 134 |
|
| 135 |
|
| 136 |
(* |
| 137 |
isMainModule - return TRUE if node, n, is the main module specified |
| 138 |
by the source file. This might be a definition, |
| 139 |
implementation or program module. |
| 140 |
*) |
| 141 |
|
| 142 |
PROCEDURE isMainModule (n: node) : BOOLEAN ; |
| 143 |
|
| 144 |
|
| 145 |
(* |
| 146 |
setMainModule - sets node, n, as the main module to be compiled. |
| 147 |
*) |
| 148 |
|
| 149 |
PROCEDURE setMainModule (n: node) ; |
| 150 |
|
| 151 |
|
| 152 |
(* |
| 153 |
setCurrentModule - sets node, n, as the current module being compiled. |
| 154 |
*) |
| 155 |
|
| 156 |
PROCEDURE setCurrentModule (n: node) ; |
| 157 |
|
| 158 |
|
| 159 |
(* |
| 160 |
lookupDef - returns a definition module node named, n. |
| 161 |
*) |
| 162 |
|
| 163 |
PROCEDURE lookupDef (n: Name) : node ; |
| 164 |
|
| 165 |
|
| 166 |
(* |
| 167 |
lookupImp - returns an implementation module node named, n. |
| 168 |
*) |
| 169 |
|
| 170 |
PROCEDURE lookupImp (n: Name) : node ; |
| 171 |
|
| 172 |
|
| 173 |
(* |
| 174 |
lookupModule - returns a module node named, n. |
| 175 |
*) |
| 176 |
|
| 177 |
PROCEDURE lookupModule (n: Name) : node ; |
| 178 |
|
| 179 |
|
| 180 |
(* |
| 181 |
putDefForC - the definition module was defined FOR "C". |
| 182 |
*) |
| 183 |
|
| 184 |
PROCEDURE putDefForC (n: node) ; |
| 185 |
|
| 186 |
|
| 187 |
(* |
| 188 |
putDefUnqualified - the definition module uses export unqualified. |
| 189 |
*) |
| 190 |
|
| 191 |
PROCEDURE putDefUnqualified (n: node) ; |
| 192 |
|
| 193 |
|
| 194 |
(* |
| 195 |
isDefUnqualified - returns TRUE if the definition module uses unqualified. |
| 196 |
*) |
| 197 |
|
| 198 |
PROCEDURE isDefUnqualified (n: node) : BOOLEAN ; |
| 199 |
|
| 200 |
|
| 201 |
(* |
| 202 |
lookupInScope - looks up a symbol named, n, from, scope. |
| 203 |
*) |
| 204 |
|
| 205 |
PROCEDURE lookupInScope (scope: node; n: Name) : node ; |
| 206 |
|
| 207 |
|
| 208 |
(* |
| 209 |
isConst - returns TRUE if node, n, is a const. |
| 210 |
*) |
| 211 |
|
| 212 |
PROCEDURE isConst (n: node) : BOOLEAN ; |
| 213 |
|
| 214 |
|
| 215 |
(* |
| 216 |
isType - returns TRUE if node, n, is a type. |
| 217 |
*) |
| 218 |
|
| 219 |
PROCEDURE isType (n: node) : BOOLEAN ; |
| 220 |
|
| 221 |
|
| 222 |
(* |
| 223 |
putType - places, exp, as the type alias to des. |
| 224 |
TYPE des = exp ; |
| 225 |
*) |
| 226 |
|
| 227 |
PROCEDURE putType (des, exp: node) ; |
| 228 |
|
| 229 |
|
| 230 |
(* |
| 231 |
getType - returns the type associated with node, n. |
| 232 |
*) |
| 233 |
|
| 234 |
PROCEDURE getType (n: node) : node ; |
| 235 |
|
| 236 |
|
| 237 |
(* |
| 238 |
skipType - skips over type aliases. |
| 239 |
*) |
| 240 |
|
| 241 |
PROCEDURE skipType (n: node) : node ; |
| 242 |
|
| 243 |
|
| 244 |
(* |
| 245 |
putTypeHidden - marks type, des, as being a hidden type. |
| 246 |
TYPE des ; |
| 247 |
*) |
| 248 |
|
| 249 |
PROCEDURE putTypeHidden (des: node) ; |
| 250 |
|
| 251 |
|
| 252 |
(* |
| 253 |
isTypeHidden - returns TRUE if type, n, is hidden. |
| 254 |
*) |
| 255 |
|
| 256 |
PROCEDURE isTypeHidden (n: node) : BOOLEAN ; |
| 257 |
|
| 258 |
|
| 259 |
(* |
| 260 |
hasHidden - returns TRUE if module, n, has a hidden type. |
| 261 |
*) |
| 262 |
|
| 263 |
PROCEDURE hasHidden (n: node) : BOOLEAN ; |
| 264 |
|
| 265 |
|
| 266 |
(* |
| 267 |
putTypeOpaque - marks type, des, as being an opaque type. |
| 268 |
TYPE des ; |
| 269 |
*) |
| 270 |
|
| 271 |
PROCEDURE putTypeOpaque (des: node) ; |
| 272 |
|
| 273 |
|
| 274 |
(* |
| 275 |
isTypeOpaque - returns TRUE if type, n, is an opaque type. |
| 276 |
*) |
| 277 |
|
| 278 |
PROCEDURE isTypeOpaque (n: node) : BOOLEAN ; |
| 279 |
|
| 280 |
|
| 281 |
(* |
| 282 |
isVar - returns TRUE if node, n, is a type. |
| 283 |
*) |
| 284 |
|
| 285 |
PROCEDURE isVar (n: node) : BOOLEAN ; |
| 286 |
|
| 287 |
|
| 288 |
(* |
| 289 |
isTemporary - returns TRUE if node, n, is a variable and temporary. |
| 290 |
*) |
| 291 |
|
| 292 |
PROCEDURE isTemporary (n: node) : BOOLEAN ; |
| 293 |
|
| 294 |
|
| 295 |
(* |
| 296 |
isExported - returns TRUE if symbol, n, is exported from |
| 297 |
the definition module. |
| 298 |
*) |
| 299 |
|
| 300 |
PROCEDURE isExported (n: node) : BOOLEAN ; |
| 301 |
|
| 302 |
|
| 303 |
(* |
| 304 |
getDeclScope - returns the node representing the |
| 305 |
current declaration scope. |
| 306 |
*) |
| 307 |
|
| 308 |
PROCEDURE getDeclScope () : node ; |
| 309 |
|
| 310 |
|
| 311 |
(* |
| 312 |
getScope - returns the scope associated with node, n. |
| 313 |
*) |
| 314 |
|
| 315 |
PROCEDURE getScope (n: node) : node ; |
| 316 |
|
| 317 |
|
| 318 |
(* |
| 319 |
isLiteral - returns TRUE if, n, is a literal. |
| 320 |
*) |
| 321 |
|
| 322 |
PROCEDURE isLiteral (n: node) : BOOLEAN ; |
| 323 |
|
| 324 |
|
| 325 |
(* |
| 326 |
isConstSet - returns TRUE if, n, is a constant set. |
| 327 |
*) |
| 328 |
|
| 329 |
PROCEDURE isConstSet (n: node) : BOOLEAN ; |
| 330 |
|
| 331 |
|
| 332 |
(* |
| 333 |
isEnumerationField - returns TRUE if, n, is an enumeration field. |
| 334 |
*) |
| 335 |
|
| 336 |
PROCEDURE isEnumerationField (n: node) : BOOLEAN ; |
| 337 |
|
| 338 |
|
| 339 |
(* |
| 340 |
isEnumeration - returns TRUE if node, n, is an enumeration type. |
| 341 |
*) |
| 342 |
|
| 343 |
PROCEDURE isEnumeration (n: node) : BOOLEAN ; |
| 344 |
|
| 345 |
|
| 346 |
(* |
| 347 |
isUnbounded - returns TRUE if, n, is an unbounded array. |
| 348 |
*) |
| 349 |
|
| 350 |
PROCEDURE isUnbounded (n: node) : BOOLEAN ; |
| 351 |
|
| 352 |
|
| 353 |
(* |
| 354 |
isParameter - returns TRUE if, n, is a parameter. |
| 355 |
*) |
| 356 |
|
| 357 |
PROCEDURE isParameter (n: node) : BOOLEAN ; |
| 358 |
|
| 359 |
|
| 360 |
(* |
| 361 |
isVarParam - returns TRUE if, n, is a var parameter. |
| 362 |
*) |
| 363 |
|
| 364 |
PROCEDURE isVarParam (n: node) : BOOLEAN ; |
| 365 |
|
| 366 |
|
| 367 |
(* |
| 368 |
isParam - returns TRUE if, n, is a non var parameter. |
| 369 |
*) |
| 370 |
|
| 371 |
PROCEDURE isParam (n: node) : BOOLEAN ; |
| 372 |
|
| 373 |
|
| 374 |
(* |
| 375 |
isNonVarParam - is an alias to isParam. |
| 376 |
*) |
| 377 |
|
| 378 |
PROCEDURE isNonVarParam (n: node) : BOOLEAN ; |
| 379 |
|
| 380 |
|
| 381 |
(* |
| 382 |
addOptParameter - returns an optarg which has been created and added to |
| 383 |
procedure node, proc. It has a name, id, and, type, |
| 384 |
and an initial value, init. |
| 385 |
*) |
| 386 |
|
| 387 |
PROCEDURE addOptParameter (proc: node; id: Name; type, init: node) : node ; |
| 388 |
|
| 389 |
|
| 390 |
(* |
| 391 |
isOptarg - returns TRUE if, n, is an optarg. |
| 392 |
*) |
| 393 |
|
| 394 |
PROCEDURE isOptarg (n: node) : BOOLEAN ; |
| 395 |
|
| 396 |
|
| 397 |
(* |
| 398 |
isRecord - returns TRUE if, n, is a record. |
| 399 |
*) |
| 400 |
|
| 401 |
PROCEDURE isRecord (n: node) : BOOLEAN ; |
| 402 |
|
| 403 |
|
| 404 |
(* |
| 405 |
isRecordField - returns TRUE if, n, is a record field. |
| 406 |
*) |
| 407 |
|
| 408 |
PROCEDURE isRecordField (n: node) : BOOLEAN ; |
| 409 |
|
| 410 |
|
| 411 |
(* |
| 412 |
isVarientField - returns TRUE if, n, is a varient field. |
| 413 |
*) |
| 414 |
|
| 415 |
PROCEDURE isVarientField (n: node) : BOOLEAN ; |
| 416 |
|
| 417 |
|
| 418 |
(* |
| 419 |
isArray - returns TRUE if, n, is an array. |
| 420 |
*) |
| 421 |
|
| 422 |
PROCEDURE isArray (n: node) : BOOLEAN ; |
| 423 |
|
| 424 |
|
| 425 |
(* |
| 426 |
isProcType - returns TRUE if, n, is a procedure type. |
| 427 |
*) |
| 428 |
|
| 429 |
PROCEDURE isProcType (n: node) : BOOLEAN ; |
| 430 |
|
| 431 |
|
| 432 |
(* |
| 433 |
isPointer - returns TRUE if, n, is a pointer. |
| 434 |
*) |
| 435 |
|
| 436 |
PROCEDURE isPointer (n: node) : BOOLEAN ; |
| 437 |
|
| 438 |
|
| 439 |
(* |
| 440 |
isProcedure - returns TRUE if, n, is a procedure. |
| 441 |
*) |
| 442 |
|
| 443 |
PROCEDURE isProcedure (n: node) : BOOLEAN ; |
| 444 |
|
| 445 |
|
| 446 |
(* |
| 447 |
isVarient - returns TRUE if, n, is a varient record. |
| 448 |
*) |
| 449 |
|
| 450 |
PROCEDURE isVarient (n: node) : BOOLEAN ; |
| 451 |
|
| 452 |
|
| 453 |
(* |
| 454 |
isSet - returns TRUE if, n, is a set type. |
| 455 |
*) |
| 456 |
|
| 457 |
PROCEDURE isSet (n: node) : BOOLEAN ; |
| 458 |
|
| 459 |
|
| 460 |
(* |
| 461 |
isSubrange - returns TRUE if, n, is a subrange type. |
| 462 |
*) |
| 463 |
|
| 464 |
PROCEDURE isSubrange (n: node) : BOOLEAN ; |
| 465 |
|
| 466 |
|
| 467 |
(* |
| 468 |
isZtype - returns TRUE if, n, is the Z type. |
| 469 |
*) |
| 470 |
|
| 471 |
PROCEDURE isZtype (n: node) : BOOLEAN ; |
| 472 |
|
| 473 |
|
| 474 |
(* |
| 475 |
isRtype - returns TRUE if, n, is the R type. |
| 476 |
*) |
| 477 |
|
| 478 |
PROCEDURE isRtype (n: node) : BOOLEAN ; |
| 479 |
|
| 480 |
|
| 481 |
(* |
| 482 |
makeConst - create, initialise and return a const node. |
| 483 |
*) |
| 484 |
|
| 485 |
PROCEDURE makeConst (n: Name) : node ; |
| 486 |
|
| 487 |
|
| 488 |
(* |
| 489 |
putConst - places value, v, into node, n. |
| 490 |
*) |
| 491 |
|
| 492 |
PROCEDURE putConst (n: node; v: node) ; |
| 493 |
|
| 494 |
|
| 495 |
(* |
| 496 |
makeType - create, initialise and return a type node. |
| 497 |
*) |
| 498 |
|
| 499 |
PROCEDURE makeType (n: Name) : node ; |
| 500 |
|
| 501 |
|
| 502 |
(* |
| 503 |
makeTypeImp - lookup a type in the definition module |
| 504 |
and return it. Otherwise create a new type. |
| 505 |
*) |
| 506 |
|
| 507 |
PROCEDURE makeTypeImp (n: Name) : node ; |
| 508 |
|
| 509 |
|
| 510 |
(* |
| 511 |
makeVar - create, initialise and return a var node. |
| 512 |
*) |
| 513 |
|
| 514 |
PROCEDURE makeVar (n: Name) : node ; |
| 515 |
|
| 516 |
|
| 517 |
(* |
| 518 |
putVar - places, type, as the type for var. |
| 519 |
*) |
| 520 |
|
| 521 |
PROCEDURE putVar (var, type, decl: node) ; |
| 522 |
|
| 523 |
|
| 524 |
(* |
| 525 |
makeVarDecl - creates a variable declaration list from |
| 526 |
identlist, i, and, type, in the current scope. |
| 527 |
*) |
| 528 |
|
| 529 |
PROCEDURE makeVarDecl (i: node; type: node) : node ; |
| 530 |
|
| 531 |
|
| 532 |
(* |
| 533 |
makeEnum - creates an enumerated type and returns the node. |
| 534 |
*) |
| 535 |
|
| 536 |
PROCEDURE makeEnum () : node ; |
| 537 |
|
| 538 |
|
| 539 |
(* |
| 540 |
makeEnumField - returns an enumeration field, named, n. |
| 541 |
*) |
| 542 |
|
| 543 |
PROCEDURE makeEnumField (e: node; n: Name) : node ; |
| 544 |
|
| 545 |
|
| 546 |
(* |
| 547 |
makeSubrange - returns a subrange node, built from range: low..high. |
| 548 |
*) |
| 549 |
|
| 550 |
PROCEDURE makeSubrange (low, high: node) : node ; |
| 551 |
|
| 552 |
|
| 553 |
(* |
| 554 |
putSubrangeType - assigns, type, to the subrange type, sub. |
| 555 |
*) |
| 556 |
|
| 557 |
PROCEDURE putSubrangeType (sub, type: node) ; |
| 558 |
|
| 559 |
|
| 560 |
(* |
| 561 |
makePointer - returns a pointer of, type, node. |
| 562 |
*) |
| 563 |
|
| 564 |
PROCEDURE makePointer (type: node) : node ; |
| 565 |
|
| 566 |
|
| 567 |
(* |
| 568 |
makeSet - returns a set of, type, node. |
| 569 |
*) |
| 570 |
|
| 571 |
PROCEDURE makeSet (type: node) : node ; |
| 572 |
|
| 573 |
|
| 574 |
(* |
| 575 |
makeArray - returns a node representing ARRAY subrange OF type. |
| 576 |
*) |
| 577 |
|
| 578 |
PROCEDURE makeArray (subr, type: node) : node ; |
| 579 |
|
| 580 |
|
| 581 |
(* |
| 582 |
putUnbounded - sets array, n, as unbounded. |
| 583 |
*) |
| 584 |
|
| 585 |
PROCEDURE putUnbounded (n: node) ; |
| 586 |
|
| 587 |
|
| 588 |
(* |
| 589 |
makeRecord - creates and returns a record node. |
| 590 |
*) |
| 591 |
|
| 592 |
PROCEDURE makeRecord () : node ; |
| 593 |
|
| 594 |
|
| 595 |
(* |
| 596 |
makeVarient - creates a new symbol, a varient symbol for record or varient field |
| 597 |
symbol, r. |
| 598 |
*) |
| 599 |
|
| 600 |
PROCEDURE makeVarient (r: node) : node ; |
| 601 |
|
| 602 |
|
| 603 |
(* |
| 604 |
addFieldsToRecord - adds fields, i, of type, t, into a record, r. |
| 605 |
It returns, r. |
| 606 |
*) |
| 607 |
|
| 608 |
PROCEDURE addFieldsToRecord (r, v, i, t: node) : node ; |
| 609 |
|
| 610 |
|
| 611 |
(* |
| 612 |
buildVarientSelector - builds a field of name, tag, of, type, t, varient, r. |
| 613 |
*) |
| 614 |
|
| 615 |
PROCEDURE buildVarientSelector (r, v: node; tag: Name; type: node) ; |
| 616 |
|
| 617 |
|
| 618 |
(* |
| 619 |
buildVarientFieldRecord - builds a varient field into a varient symbol, v. |
| 620 |
The varient field is returned. |
| 621 |
*) |
| 622 |
|
| 623 |
PROCEDURE buildVarientFieldRecord (v: node; p: node) : node ; |
| 624 |
|
| 625 |
|
| 626 |
(* |
| 627 |
getSymName - returns the name of symbol, n. |
| 628 |
*) |
| 629 |
|
| 630 |
PROCEDURE getSymName (n: node) : Name ; |
| 631 |
|
| 632 |
|
| 633 |
(* |
| 634 |
import - attempts to add node, n, into the scope of module, m. |
| 635 |
It might fail due to a name clash in which case the |
| 636 |
previous named symbol is returned. On success, n, |
| 637 |
is returned. |
| 638 |
*) |
| 639 |
|
| 640 |
PROCEDURE import (m, n: node) : node ; |
| 641 |
|
| 642 |
|
| 643 |
(* |
| 644 |
lookupExported - attempts to lookup a node named, i, from definition |
| 645 |
module, n. The node is returned if found. |
| 646 |
NIL is returned if not found. |
| 647 |
*) |
| 648 |
|
| 649 |
PROCEDURE lookupExported (n: node; i: Name) : node ; |
| 650 |
|
| 651 |
|
| 652 |
(* |
| 653 |
lookupSym - returns the symbol named, n, from the scope stack. |
| 654 |
*) |
| 655 |
|
| 656 |
PROCEDURE lookupSym (n: Name) : node ; |
| 657 |
|
| 658 |
|
| 659 |
(* |
| 660 |
addImportedModule - add module, i, to be imported by, m. |
| 661 |
If scoped then module, i, is added to the |
| 662 |
module, m, scope. |
| 663 |
*) |
| 664 |
|
| 665 |
PROCEDURE addImportedModule (m, i: node; scoped: BOOLEAN) ; |
| 666 |
|
| 667 |
|
| 668 |
(* |
| 669 |
setSource - sets the source filename for module, n, to s. |
| 670 |
*) |
| 671 |
|
| 672 |
PROCEDURE setSource (n: node; s: Name) ; |
| 673 |
|
| 674 |
|
| 675 |
(* |
| 676 |
getSource - returns the source filename for module, n. |
| 677 |
*) |
| 678 |
|
| 679 |
PROCEDURE getSource (n: node) : Name ; |
| 680 |
|
| 681 |
|
| 682 |
(* |
| 683 |
getMainModule - returns the main module node. |
| 684 |
*) |
| 685 |
|
| 686 |
PROCEDURE getMainModule () : node ; |
| 687 |
|
| 688 |
|
| 689 |
(* |
| 690 |
getCurrentModule - returns the current module being compiled. |
| 691 |
*) |
| 692 |
|
| 693 |
PROCEDURE getCurrentModule () : node ; |
| 694 |
|
| 695 |
|
| 696 |
(* |
| 697 |
foreachDefModuleDo - foreach definition node, n, in the module universe, |
| 698 |
call p (n). |
| 699 |
*) |
| 700 |
|
| 701 |
PROCEDURE foreachDefModuleDo (p: performOperation) ; |
| 702 |
|
| 703 |
|
| 704 |
(* |
| 705 |
foreachModModuleDo - foreach implementation or module node, n, in the module universe, |
| 706 |
call p (n). |
| 707 |
*) |
| 708 |
|
| 709 |
PROCEDURE foreachModModuleDo (p: performOperation) ; |
| 710 |
|
| 711 |
|
| 712 |
(* |
| 713 |
enterScope - pushes symbol, n, to the scope stack. |
| 714 |
*) |
| 715 |
|
| 716 |
PROCEDURE enterScope (n: node) ; |
| 717 |
|
| 718 |
|
| 719 |
(* |
| 720 |
leaveScope - removes the top level scope and all enumeration transparent scopes. |
| 721 |
*) |
| 722 |
|
| 723 |
PROCEDURE leaveScope ; |
| 724 |
|
| 725 |
|
| 726 |
(* |
| 727 |
makeProcedure - create, initialise and return a procedure node. |
| 728 |
*) |
| 729 |
|
| 730 |
PROCEDURE makeProcedure (n: Name) : node ; |
| 731 |
|
| 732 |
|
| 733 |
(* |
| 734 |
putCommentDefProcedure - remembers the procedure comment (if it exists) as a |
| 735 |
definition module procedure heading. NIL is placed |
| 736 |
if there is no procedure comment available. |
| 737 |
*) |
| 738 |
|
| 739 |
PROCEDURE putCommentDefProcedure (n: node) ; |
| 740 |
|
| 741 |
|
| 742 |
(* |
| 743 |
putCommentModProcedure - remembers the procedure comment (if it exists) as an |
| 744 |
implementation/program module procedure heading. NIL is placed |
| 745 |
if there is no procedure comment available. |
| 746 |
*) |
| 747 |
|
| 748 |
PROCEDURE putCommentModProcedure (n: node) ; |
| 749 |
|
| 750 |
|
| 751 |
(* |
| 752 |
makeProcType - returns a proctype node. |
| 753 |
*) |
| 754 |
|
| 755 |
PROCEDURE makeProcType () : node ; |
| 756 |
|
| 757 |
|
| 758 |
(* |
| 759 |
putReturnType - sets the return type of procedure or proctype, proc, to, type. |
| 760 |
*) |
| 761 |
|
| 762 |
PROCEDURE putReturnType (proc, type: node) ; |
| 763 |
|
| 764 |
|
| 765 |
(* |
| 766 |
putOptReturn - sets, proctype or procedure, proc, to have an optional return type. |
| 767 |
*) |
| 768 |
|
| 769 |
PROCEDURE putOptReturn (proc: node) ; |
| 770 |
|
| 771 |
|
| 772 |
(* |
| 773 |
makeVarParameter - returns a var parameter node with namelist and type. |
| 774 |
Where the parameters are declared as l: type. |
| 775 |
*) |
| 776 |
|
| 777 |
PROCEDURE makeVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ; |
| 778 |
|
| 779 |
|
| 780 |
(* |
| 781 |
makeNonVarParameter - returns a non var parameter node with namelist and type. |
| 782 |
Where the parameters are declared as l: type. |
| 783 |
*) |
| 784 |
|
| 785 |
PROCEDURE makeNonVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ; |
| 786 |
|
| 787 |
|
| 788 |
(* |
| 789 |
paramEnter - reset the parameter count. |
| 790 |
*) |
| 791 |
|
| 792 |
PROCEDURE paramEnter (n: node) ; |
| 793 |
|
| 794 |
|
| 795 |
(* |
| 796 |
paramLeave - set paramater checking to TRUE from now onwards. |
| 797 |
*) |
| 798 |
|
| 799 |
PROCEDURE paramLeave (n: node) ; |
| 800 |
|
| 801 |
|
| 802 |
(* |
| 803 |
makeIdentList - returns a node which will be used to maintain an ident list. |
| 804 |
*) |
| 805 |
|
| 806 |
PROCEDURE makeIdentList () : node ; |
| 807 |
|
| 808 |
|
| 809 |
(* |
| 810 |
putIdent - places ident, i, into identlist, n. |
| 811 |
*) |
| 812 |
|
| 813 |
PROCEDURE putIdent (n: node; i: Name) : BOOLEAN ; |
| 814 |
|
| 815 |
|
| 816 |
(* |
| 817 |
addVarParameters - adds the identlist, i, of, type, to be VAR parameters |
| 818 |
in procedure, n. |
| 819 |
*) |
| 820 |
|
| 821 |
PROCEDURE addVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ; |
| 822 |
|
| 823 |
|
| 824 |
(* |
| 825 |
addNonVarParameters - adds the identlist, i, of, type, to be parameters |
| 826 |
in procedure, n. |
| 827 |
*) |
| 828 |
|
| 829 |
PROCEDURE addNonVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ; |
| 830 |
|
| 831 |
|
| 832 |
(* |
| 833 |
makeVarargs - returns a varargs node. |
| 834 |
*) |
| 835 |
|
| 836 |
PROCEDURE makeVarargs () : node ; |
| 837 |
|
| 838 |
|
| 839 |
(* |
| 840 |
isVarargs - returns TRUE if, n, is a varargs node. |
| 841 |
*) |
| 842 |
|
| 843 |
PROCEDURE isVarargs (n: node) : BOOLEAN ; |
| 844 |
|
| 845 |
|
| 846 |
(* |
| 847 |
addParameter - adds a parameter, param, to procedure or proctype, proc. |
| 848 |
*) |
| 849 |
|
| 850 |
PROCEDURE addParameter (proc, param: node) ; |
| 851 |
|
| 852 |
|
| 853 |
(* |
| 854 |
makeBinaryTok - creates and returns a boolean type node with, |
| 855 |
l, and, r, nodes. |
| 856 |
*) |
| 857 |
|
| 858 |
PROCEDURE makeBinaryTok (op: toktype; l, r: node) : node ; |
| 859 |
|
| 860 |
|
| 861 |
(* |
| 862 |
makeUnaryTok - creates and returns a boolean type node with, |
| 863 |
e, node. |
| 864 |
*) |
| 865 |
|
| 866 |
PROCEDURE makeUnaryTok (op: toktype; e: node) : node ; |
| 867 |
|
| 868 |
|
| 869 |
(* |
| 870 |
makeComponentRef - build a componentref node which accesses, field, |
| 871 |
within, record, rec. |
| 872 |
*) |
| 873 |
|
| 874 |
PROCEDURE makeComponentRef (rec, field: node) : node ; |
| 875 |
|
| 876 |
|
| 877 |
(* |
| 878 |
makePointerRef - build a pointerref node which accesses, field, |
| 879 |
within, pointer to record, ptr. |
| 880 |
*) |
| 881 |
|
| 882 |
PROCEDURE makePointerRef (ptr, field: node) : node ; |
| 883 |
|
| 884 |
|
| 885 |
(* |
| 886 |
isPointerRef - returns TRUE if, n, is a pointerref node. |
| 887 |
*) |
| 888 |
|
| 889 |
PROCEDURE isPointerRef (n: node) : BOOLEAN ; |
| 890 |
|
| 891 |
|
| 892 |
(* |
| 893 |
makeDeRef - dereferences the pointer defined by, n. |
| 894 |
*) |
| 895 |
|
| 896 |
PROCEDURE makeDeRef (n: node) : node ; |
| 897 |
|
| 898 |
|
| 899 |
(* |
| 900 |
makeArrayRef - build an arrayref node which access element, |
| 901 |
index, in, array. array is a variable/expression/constant |
| 902 |
which has a type array. |
| 903 |
*) |
| 904 |
|
| 905 |
PROCEDURE makeArrayRef (array, index: node) : node ; |
| 906 |
|
| 907 |
|
| 908 |
(* |
| 909 |
getLastOp - return the right most non leaf node. |
| 910 |
*) |
| 911 |
|
| 912 |
PROCEDURE getLastOp (n: node) : node ; |
| 913 |
|
| 914 |
|
| 915 |
(* |
| 916 |
getCardinal - returns the cardinal type node. |
| 917 |
*) |
| 918 |
|
| 919 |
PROCEDURE getCardinal () : node ; |
| 920 |
|
| 921 |
|
| 922 |
(* |
| 923 |
makeLiteralInt - creates and returns a literal node based on an integer type. |
| 924 |
*) |
| 925 |
|
| 926 |
PROCEDURE makeLiteralInt (n: Name) : node ; |
| 927 |
|
| 928 |
|
| 929 |
(* |
| 930 |
makeLiteralReal - creates and returns a literal node based on a real type. |
| 931 |
*) |
| 932 |
|
| 933 |
PROCEDURE makeLiteralReal (n: Name) : node ; |
| 934 |
|
| 935 |
|
| 936 |
(* |
| 937 |
makeString - creates and returns a node containing string, n. |
| 938 |
*) |
| 939 |
|
| 940 |
PROCEDURE makeString (n: Name) : node ; |
| 941 |
|
| 942 |
|
| 943 |
(* |
| 944 |
makeSetValue - creates and returns a setvalue node. |
| 945 |
*) |
| 946 |
|
| 947 |
PROCEDURE makeSetValue () : node ; |
| 948 |
|
| 949 |
|
| 950 |
(* |
| 951 |
isSetValue - returns TRUE if, n, is a setvalue node. |
| 952 |
*) |
| 953 |
|
| 954 |
PROCEDURE isSetValue (n: node) : BOOLEAN ; |
| 955 |
|
| 956 |
|
| 957 |
(* |
| 958 |
putSetValue - assigns the type, t, to the set value, n. The |
| 959 |
node, n, is returned. |
| 960 |
*) |
| 961 |
|
| 962 |
PROCEDURE putSetValue (n, t: node) : node ; |
| 963 |
|
| 964 |
|
| 965 |
(* |
| 966 |
includeSetValue - includes the range l..h into the setvalue. |
| 967 |
h might be NIL indicating that a single element |
| 968 |
is to be included into the set. |
| 969 |
n is returned. |
| 970 |
*) |
| 971 |
|
| 972 |
PROCEDURE includeSetValue (n: node; l, h: node) : node ; |
| 973 |
|
| 974 |
|
| 975 |
(* |
| 976 |
getBuiltinConst - creates and returns a builtin const if available. |
| 977 |
*) |
| 978 |
|
| 979 |
PROCEDURE getBuiltinConst (n: Name) : node ; |
| 980 |
|
| 981 |
|
| 982 |
(* |
| 983 |
makeExpList - creates and returns an expList node. |
| 984 |
*) |
| 985 |
|
| 986 |
PROCEDURE makeExpList () : node ; |
| 987 |
|
| 988 |
|
| 989 |
(* |
| 990 |
isExpList - returns TRUE if, n, is an explist node. |
| 991 |
*) |
| 992 |
|
| 993 |
PROCEDURE isExpList (n: node) : BOOLEAN ; |
| 994 |
|
| 995 |
|
| 996 |
(* |
| 997 |
putExpList - places, expression, e, within the explist, n. |
| 998 |
*) |
| 999 |
|
| 1000 |
PROCEDURE putExpList (n: node; e: node) ; |
| 1001 |
|
| 1002 |
|
| 1003 |
(* |
| 1004 |
makeConstExp - returns a constexp node. |
| 1005 |
*) |
| 1006 |
|
| 1007 |
PROCEDURE makeConstExp () : node ; |
| 1008 |
|
| 1009 |
|
| 1010 |
(* |
| 1011 |
getNextConstExp - returns the next constexp node. |
| 1012 |
*) |
| 1013 |
|
| 1014 |
PROCEDURE getNextConstExp () : node ; |
| 1015 |
|
| 1016 |
|
| 1017 |
(* |
| 1018 |
setConstExpComplete - sets the field inside the def or imp or module, n. |
| 1019 |
*) |
| 1020 |
|
| 1021 |
PROCEDURE setConstExpComplete (n: node) ; |
| 1022 |
|
| 1023 |
|
| 1024 |
(* |
| 1025 |
fixupConstExp - assign fixup expression, e, into the argument of, c. |
| 1026 |
*) |
| 1027 |
|
| 1028 |
PROCEDURE fixupConstExp (c, e: node) : node ; |
| 1029 |
|
| 1030 |
|
| 1031 |
(* |
| 1032 |
resetConstExpPos - resets the index into the saved list of constexps inside |
| 1033 |
module, n. |
| 1034 |
*) |
| 1035 |
|
| 1036 |
PROCEDURE resetConstExpPos (n: node) ; |
| 1037 |
|
| 1038 |
|
| 1039 |
(* |
| 1040 |
makeFuncCall - builds a function call to c with param list, n. |
| 1041 |
*) |
| 1042 |
|
| 1043 |
PROCEDURE makeFuncCall (c, n: node) : node ; |
| 1044 |
|
| 1045 |
|
| 1046 |
(* |
| 1047 |
makeStatementSequence - create and return a statement sequence node. |
| 1048 |
*) |
| 1049 |
|
| 1050 |
PROCEDURE makeStatementSequence () : node ; |
| 1051 |
|
| 1052 |
|
| 1053 |
(* |
| 1054 |
isStatementSequence - returns TRUE if node, n, is a statement sequence. |
| 1055 |
*) |
| 1056 |
|
| 1057 |
PROCEDURE isStatementSequence (n: node) : BOOLEAN ; |
| 1058 |
|
| 1059 |
|
| 1060 |
(* |
| 1061 |
addStatement - adds node, n, as a statement to statememt sequence, s. |
| 1062 |
*) |
| 1063 |
|
| 1064 |
PROCEDURE addStatement (s: node; n: node) ; |
| 1065 |
|
| 1066 |
|
| 1067 |
(* |
| 1068 |
addCommentBody - adds a body comment to a statement sequence node. |
| 1069 |
*) |
| 1070 |
|
| 1071 |
PROCEDURE addCommentBody (n: node) ; |
| 1072 |
|
| 1073 |
|
| 1074 |
(* |
| 1075 |
addCommentAfter - adds an after comment to a statement sequence node. |
| 1076 |
*) |
| 1077 |
|
| 1078 |
PROCEDURE addCommentAfter (n: node) ; |
| 1079 |
|
| 1080 |
|
| 1081 |
(* |
| 1082 |
addIfComments - adds the, body, and, after, comments to if node, n. |
| 1083 |
*) |
| 1084 |
|
| 1085 |
PROCEDURE addIfComments (n: node; body, after: node) ; |
| 1086 |
|
| 1087 |
|
| 1088 |
(* |
| 1089 |
addElseComments - adds the, body, and, after, comments to an, if, or an elsif, node, n. |
| 1090 |
*) |
| 1091 |
|
| 1092 |
PROCEDURE addElseComments (n: node; body, after: node) ; |
| 1093 |
|
| 1094 |
|
| 1095 |
(* |
| 1096 |
addIfEndComments - adds the, body, and, after, comments to an, if, node, n. |
| 1097 |
*) |
| 1098 |
|
| 1099 |
PROCEDURE addIfEndComments (n: node; body, after: node) ; |
| 1100 |
|
| 1101 |
|
| 1102 |
(* |
| 1103 |
makeReturn - creates and returns a return node. |
| 1104 |
*) |
| 1105 |
|
| 1106 |
PROCEDURE makeReturn () : node ; |
| 1107 |
|
| 1108 |
|
| 1109 |
(* |
| 1110 |
isReturn - returns TRUE if node, n, is a return. |
| 1111 |
*) |
| 1112 |
|
| 1113 |
PROCEDURE isReturn (n: node) : BOOLEAN ; |
| 1114 |
|
| 1115 |
|
| 1116 |
(* |
| 1117 |
putReturn - assigns node, e, as the expression on the return node. |
| 1118 |
*) |
| 1119 |
|
| 1120 |
PROCEDURE putReturn (n: node; e: node) ; |
| 1121 |
|
| 1122 |
|
| 1123 |
(* |
| 1124 |
makeWhile - creates and returns a while node. |
| 1125 |
*) |
| 1126 |
|
| 1127 |
PROCEDURE makeWhile () : node ; |
| 1128 |
|
| 1129 |
|
| 1130 |
(* |
| 1131 |
putWhile - places an expression, e, and statement sequence, s, into the while |
| 1132 |
node, n. |
| 1133 |
*) |
| 1134 |
|
| 1135 |
PROCEDURE putWhile (n: node; e, s: node) ; |
| 1136 |
|
| 1137 |
|
| 1138 |
(* |
| 1139 |
isWhile - returns TRUE if node, n, is a while. |
| 1140 |
*) |
| 1141 |
|
| 1142 |
PROCEDURE isWhile (n: node) : BOOLEAN ; |
| 1143 |
|
| 1144 |
|
| 1145 |
(* |
| 1146 |
addWhileDoComment - adds body and after comments to while node, w. |
| 1147 |
*) |
| 1148 |
|
| 1149 |
PROCEDURE addWhileDoComment (w: node; body, after: node) ; |
| 1150 |
|
| 1151 |
|
| 1152 |
(* |
| 1153 |
addWhileEndComment - adds body and after comments to the end of a while node, w. |
| 1154 |
*) |
| 1155 |
|
| 1156 |
PROCEDURE addWhileEndComment (w: node; body, after: node) ; |
| 1157 |
|
| 1158 |
|
| 1159 |
(* |
| 1160 |
makeAssignment - creates and returns an assignment node. |
| 1161 |
The designator is, d, and expression, e. |
| 1162 |
*) |
| 1163 |
|
| 1164 |
PROCEDURE makeAssignment (d, e: node) : node ; |
| 1165 |
|
| 1166 |
|
| 1167 |
(* |
| 1168 |
putBegin - assigns statements, s, to be the normal part in |
| 1169 |
block, b. The block may be a procedure or module, |
| 1170 |
or implementation node. |
| 1171 |
*) |
| 1172 |
|
| 1173 |
PROCEDURE putBegin (b: node; s: node) ; |
| 1174 |
|
| 1175 |
|
| 1176 |
(* |
| 1177 |
putFinally - assigns statements, s, to be the final part in |
| 1178 |
block, b. The block may be a module |
| 1179 |
or implementation node. |
| 1180 |
*) |
| 1181 |
|
| 1182 |
PROCEDURE putFinally (b: node; s: node) ; |
| 1183 |
|
| 1184 |
|
| 1185 |
(* |
| 1186 |
makeExit - creates and returns an exit node. |
| 1187 |
*) |
| 1188 |
|
| 1189 |
PROCEDURE makeExit (l: node; n: CARDINAL) : node ; |
| 1190 |
|
| 1191 |
|
| 1192 |
(* |
| 1193 |
isExit - returns TRUE if node, n, is an exit. |
| 1194 |
*) |
| 1195 |
|
| 1196 |
PROCEDURE isExit (n: node) : BOOLEAN ; |
| 1197 |
|
| 1198 |
|
| 1199 |
(* |
| 1200 |
makeLoop - creates and returns a loop node. |
| 1201 |
*) |
| 1202 |
|
| 1203 |
PROCEDURE makeLoop () : node ; |
| 1204 |
|
| 1205 |
|
| 1206 |
(* |
| 1207 |
isLoop - returns TRUE if, n, is a loop node. |
| 1208 |
*) |
| 1209 |
|
| 1210 |
PROCEDURE isLoop (n: node) : BOOLEAN ; |
| 1211 |
|
| 1212 |
|
| 1213 |
(* |
| 1214 |
putLoop - places statement sequence, s, into loop, l. |
| 1215 |
*) |
| 1216 |
|
| 1217 |
PROCEDURE putLoop (l, s: node) ; |
| 1218 |
|
| 1219 |
|
| 1220 |
(* |
| 1221 |
makeComment - creates and returns a comment node. |
| 1222 |
*) |
| 1223 |
|
| 1224 |
PROCEDURE makeComment (a: ARRAY OF CHAR) : node ; |
| 1225 |
|
| 1226 |
|
| 1227 |
(* |
| 1228 |
makeCommentS - creates and returns a comment node. |
| 1229 |
*) |
| 1230 |
|
| 1231 |
PROCEDURE makeCommentS (c: commentDesc) : node ; |
| 1232 |
|
| 1233 |
|
| 1234 |
(* |
| 1235 |
makeIf - creates and returns an if node. The if node |
| 1236 |
will have expression, e, and statement sequence, s, |
| 1237 |
as the then component. |
| 1238 |
*) |
| 1239 |
|
| 1240 |
PROCEDURE makeIf (e, s: node) : node ; |
| 1241 |
|
| 1242 |
|
| 1243 |
(* |
| 1244 |
isIf - returns TRUE if, n, is an if node. |
| 1245 |
*) |
| 1246 |
|
| 1247 |
PROCEDURE isIf (n: node) : BOOLEAN ; |
| 1248 |
|
| 1249 |
|
| 1250 |
(* |
| 1251 |
makeElsif - creates and returns an elsif node. |
| 1252 |
This node has an expression, e, and statement |
| 1253 |
sequence, s. |
| 1254 |
*) |
| 1255 |
|
| 1256 |
PROCEDURE makeElsif (i, e, s: node) : node ; |
| 1257 |
|
| 1258 |
|
| 1259 |
(* |
| 1260 |
isElsif - returns TRUE if node, n, is an elsif node. |
| 1261 |
*) |
| 1262 |
|
| 1263 |
PROCEDURE isElsif (n: node) : BOOLEAN ; |
| 1264 |
|
| 1265 |
|
| 1266 |
(* |
| 1267 |
putElse - the else is grafted onto the if/elsif node, i, |
| 1268 |
and the statement sequence will be, s. |
| 1269 |
*) |
| 1270 |
|
| 1271 |
PROCEDURE putElse (i, s: node) ; |
| 1272 |
|
| 1273 |
|
| 1274 |
(* |
| 1275 |
makeFor - creates and returns a for node. |
| 1276 |
*) |
| 1277 |
|
| 1278 |
PROCEDURE makeFor () : node ; |
| 1279 |
|
| 1280 |
|
| 1281 |
(* |
| 1282 |
isFor - returns TRUE if node, n, is a for node. |
| 1283 |
*) |
| 1284 |
|
| 1285 |
PROCEDURE isFor (n: node) : BOOLEAN ; |
| 1286 |
|
| 1287 |
|
| 1288 |
(* |
| 1289 |
putFor - assigns the fields of the for node with |
| 1290 |
ident, i, |
| 1291 |
start, s, |
| 1292 |
end, e, |
| 1293 |
increment, i, |
| 1294 |
statements, sq. |
| 1295 |
*) |
| 1296 |
|
| 1297 |
PROCEDURE putFor (f, i, s, e, b, sq: node) ; |
| 1298 |
|
| 1299 |
|
| 1300 |
(* |
| 1301 |
makeRepeat - creates and returns a repeat node. |
| 1302 |
*) |
| 1303 |
|
| 1304 |
PROCEDURE makeRepeat () : node ; |
| 1305 |
|
| 1306 |
|
| 1307 |
(* |
| 1308 |
isRepeat - returns TRUE if node, n, is a repeat node. |
| 1309 |
*) |
| 1310 |
|
| 1311 |
PROCEDURE isRepeat (n: node) : BOOLEAN ; |
| 1312 |
|
| 1313 |
|
| 1314 |
(* |
| 1315 |
putRepeat - places statements, s, and expression, e, into |
| 1316 |
repeat statement, n. |
| 1317 |
*) |
| 1318 |
|
| 1319 |
PROCEDURE putRepeat (n, s, e: node) ; |
| 1320 |
|
| 1321 |
|
| 1322 |
(* |
| 1323 |
addRepeatComment - adds body and after comments to repeat node, r. |
| 1324 |
*) |
| 1325 |
|
| 1326 |
PROCEDURE addRepeatComment (r: node; body, after: node) ; |
| 1327 |
|
| 1328 |
|
| 1329 |
(* |
| 1330 |
addUntilComment - adds body and after comments to the until section of a repeat node, r. |
| 1331 |
*) |
| 1332 |
|
| 1333 |
PROCEDURE addUntilComment (r: node; body, after: node) ; |
| 1334 |
|
| 1335 |
|
| 1336 |
(* |
| 1337 |
makeCase - builds and returns a case statement node. |
| 1338 |
*) |
| 1339 |
|
| 1340 |
PROCEDURE makeCase () : node ; |
| 1341 |
|
| 1342 |
|
| 1343 |
(* |
| 1344 |
isCase - returns TRUE if node, n, is a case statement. |
| 1345 |
*) |
| 1346 |
|
| 1347 |
PROCEDURE isCase (n: node) : BOOLEAN ; |
| 1348 |
|
| 1349 |
|
| 1350 |
(* |
| 1351 |
putCaseExpression - places expression, e, into case statement, n. |
| 1352 |
n is returned. |
| 1353 |
*) |
| 1354 |
|
| 1355 |
PROCEDURE putCaseExpression (n: node; e: node) : node ; |
| 1356 |
|
| 1357 |
|
| 1358 |
(* |
| 1359 |
putCaseElse - places else statement, e, into case statement, n. |
| 1360 |
n is returned. |
| 1361 |
*) |
| 1362 |
|
| 1363 |
PROCEDURE putCaseElse (n: node; e: node) : node ; |
| 1364 |
|
| 1365 |
|
| 1366 |
(* |
| 1367 |
putCaseStatement - places a caselist, l, and associated |
| 1368 |
statement sequence, s, into case statement, n. |
| 1369 |
n is returned. |
| 1370 |
*) |
| 1371 |
|
| 1372 |
PROCEDURE putCaseStatement (n: node; l: node; s: node) : node ; |
| 1373 |
|
| 1374 |
|
| 1375 |
(* |
| 1376 |
makeCaseLabelList - creates and returns a caselabellist node. |
| 1377 |
*) |
| 1378 |
|
| 1379 |
PROCEDURE makeCaseLabelList (l, s: node) : node ; |
| 1380 |
|
| 1381 |
|
| 1382 |
(* |
| 1383 |
isCaseLabelList - returns TRUE if, n, is a caselabellist. |
| 1384 |
*) |
| 1385 |
|
| 1386 |
PROCEDURE isCaseLabelList (n: node) : BOOLEAN ; |
| 1387 |
|
| 1388 |
|
| 1389 |
(* |
| 1390 |
makeCaseList - creates and returns a case statement node. |
| 1391 |
*) |
| 1392 |
|
| 1393 |
PROCEDURE makeCaseList () : node ; |
| 1394 |
|
| 1395 |
|
| 1396 |
(* |
| 1397 |
isCaseList - returns TRUE if, n, is a case list. |
| 1398 |
*) |
| 1399 |
|
| 1400 |
PROCEDURE isCaseList (n: node) : BOOLEAN ; |
| 1401 |
|
| 1402 |
|
| 1403 |
(* |
| 1404 |
putCaseRange - places the case range lo..hi into caselist, n. |
| 1405 |
*) |
| 1406 |
|
| 1407 |
PROCEDURE putCaseRange (n: node; lo, hi: node) : node ; |
| 1408 |
|
| 1409 |
|
| 1410 |
(* |
| 1411 |
makeRange - creates and returns a case range. |
| 1412 |
*) |
| 1413 |
|
| 1414 |
PROCEDURE makeRange (lo, hi: node) : node ; |
| 1415 |
|
| 1416 |
|
| 1417 |
(* |
| 1418 |
isRange - returns TRUE if node, n, is a range. |
| 1419 |
*) |
| 1420 |
|
| 1421 |
PROCEDURE isRange (n: node) : BOOLEAN ; |
| 1422 |
|
| 1423 |
|
| 1424 |
(* |
| 1425 |
setNoReturn - sets noreturn field inside procedure. |
| 1426 |
*) |
| 1427 |
|
| 1428 |
PROCEDURE setNoReturn (n: node; value: BOOLEAN) ; |
| 1429 |
|
| 1430 |
|
| 1431 |
(* |
| 1432 |
dupExpr - duplicate the expression nodes, it does not duplicate |
| 1433 |
variables, literals, constants but only the expression |
| 1434 |
operators (including function calls and parameter lists). |
| 1435 |
*) |
| 1436 |
|
| 1437 |
PROCEDURE dupExpr (n: node) : node ; |
| 1438 |
|
| 1439 |
|
| 1440 |
(* |
| 1441 |
setLangC - set the target language as ansi C. |
| 1442 |
*) |
| 1443 |
|
| 1444 |
PROCEDURE setLangC ; |
| 1445 |
|
| 1446 |
|
| 1447 |
(* |
| 1448 |
setLangCP - set the target language as C++. |
| 1449 |
*) |
| 1450 |
|
| 1451 |
PROCEDURE setLangCP ; |
| 1452 |
|
| 1453 |
|
| 1454 |
(* |
| 1455 |
setLangM2 - set the target language as Modula-2. |
| 1456 |
*) |
| 1457 |
|
| 1458 |
PROCEDURE setLangM2 ; |
| 1459 |
|
| 1460 |
|
| 1461 |
(* |
| 1462 |
out - walks the tree of node declarations for the main module |
| 1463 |
and writes the output to the outputFile specified in |
| 1464 |
mcOptions. It outputs the declarations in the language |
| 1465 |
specified above. |
| 1466 |
*) |
| 1467 |
|
| 1468 |
PROCEDURE out ; |
| 1469 |
|
| 1470 |
|
| 1471 |
END decl. |