FoxSyntaxTree.SymW 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727
  1. MODULE FoxSyntaxTree;
  2. IMPORT Basic := FoxBasic, Scanner := FoxScanner, BitSets, StringPool, Strings;
  3. CONST
  4. OberonCallingConvention* = 0;
  5. CCallingConvention* = 1;
  6. WinAPICallingConvention* = 2;
  7. DarwinCCallingConvention* = 3;
  8. InterruptCallingConvention* = 4;
  9. InternalRead* = 0;
  10. InternalWrite* = 1;
  11. ProtectedRead* = 2;
  12. ProtectedWrite* = 3;
  13. PublicRead* = 4;
  14. PublicWrite* = 5;
  15. Hidden* = {};
  16. Internal* = {InternalRead, InternalWrite};
  17. Protected* = {ProtectedRead, ProtectedWrite};
  18. Public* = {PublicRead, PublicWrite};
  19. ReadOnly* = {InternalRead, ProtectedRead, PublicRead};
  20. ValueParameter* = 0;
  21. VarParameter* = 1;
  22. ConstParameter* = 2;
  23. InPort* = 3;
  24. OutPort* = 4;
  25. Static* = 1;
  26. Open* = 2;
  27. Tensor* = 3;
  28. SemiDynamic* = 4;
  29. Undefined* = {};
  30. BeingResolved* = 1;
  31. Resolved* = 2;
  32. FingerPrinted* = 3;
  33. Warned* = 4;
  34. ArrayIndex* = 0;
  35. SetElement* = 1;
  36. CaseGuard* = 2;
  37. FlagProcedureDelegate* = 0;
  38. FlagProcedureConstructor* = 1;
  39. FlagParameterVar* = 1;
  40. FlagParameterConst* = 2;
  41. TYPE
  42. Position* = Scanner.Position;
  43. SourceCode* = Scanner.StringType;
  44. BinaryCode* = BitSets.BitSet;
  45. String* = Scanner.StringType;
  46. IdentifierString* = Scanner.IdentifierString;
  47. CallingConvention* = LONGINT;
  48. Visitor* = OBJECT
  49. PROCEDURE ^ VisitType*(x: Type);
  50. PROCEDURE ^ VisitBasicType*(x: BasicType);
  51. PROCEDURE ^ VisitByteType*(x: ByteType);
  52. PROCEDURE ^ VisitAnyType*(x: AnyType);
  53. PROCEDURE ^ VisitObjectType*(x: ObjectType);
  54. PROCEDURE ^ VisitNilType*(x: NilType);
  55. PROCEDURE ^ VisitAddressType*(x: AddressType);
  56. PROCEDURE ^ VisitSizeType*(x: SizeType);
  57. PROCEDURE ^ VisitBooleanType*(x: BooleanType);
  58. PROCEDURE ^ VisitSetType*(x: SetType);
  59. PROCEDURE ^ VisitCharacterType*(x: CharacterType);
  60. PROCEDURE ^ VisitIntegerType*(x: IntegerType);
  61. PROCEDURE ^ VisitFloatType*(x: FloatType);
  62. PROCEDURE ^ VisitComplexType*(x: ComplexType);
  63. PROCEDURE ^ VisitQualifiedType*(x: QualifiedType);
  64. PROCEDURE ^ VisitStringType*(x: StringType);
  65. PROCEDURE ^ VisitEnumerationType*(x: EnumerationType);
  66. PROCEDURE ^ VisitRangeType*(x: RangeType);
  67. PROCEDURE ^ VisitArrayType*(x: ArrayType);
  68. PROCEDURE ^ VisitMathArrayType*(x: MathArrayType);
  69. PROCEDURE ^ VisitPointerType*(x: PointerType);
  70. PROCEDURE ^ VisitPortType*(x: PortType);
  71. PROCEDURE ^ VisitRecordType*(x: RecordType);
  72. PROCEDURE ^ VisitCellType*(x: CellType);
  73. PROCEDURE ^ VisitProcedureType*(x: ProcedureType);
  74. PROCEDURE ^ VisitExpression*(x: Expression);
  75. PROCEDURE ^ VisitSet*(x: Set);
  76. PROCEDURE ^ VisitMathArrayExpression*(x: MathArrayExpression);
  77. PROCEDURE ^ VisitUnaryExpression*(x: UnaryExpression);
  78. PROCEDURE ^ VisitBinaryExpression*(x: BinaryExpression);
  79. PROCEDURE ^ VisitRangeExpression*(x: RangeExpression);
  80. PROCEDURE ^ VisitTensorRangeExpression*(x: TensorRangeExpression);
  81. PROCEDURE ^ VisitConversion*(x: Conversion);
  82. PROCEDURE ^ VisitDesignator*(x: Designator);
  83. PROCEDURE ^ VisitIdentifierDesignator*(x: IdentifierDesignator);
  84. PROCEDURE ^ VisitSelectorDesignator*(x: SelectorDesignator);
  85. PROCEDURE ^ VisitParameterDesignator*(x: ParameterDesignator);
  86. PROCEDURE ^ VisitArrowDesignator*(x: ArrowDesignator);
  87. PROCEDURE ^ VisitBracketDesignator*(x: BracketDesignator);
  88. PROCEDURE ^ VisitSymbolDesignator*(x: SymbolDesignator);
  89. PROCEDURE ^ VisitIndexDesignator*(x: IndexDesignator);
  90. PROCEDURE ^ VisitProcedureCallDesignator*(x: ProcedureCallDesignator);
  91. PROCEDURE ^ VisitStatementDesignator*(x: StatementDesignator);
  92. PROCEDURE ^ VisitBuiltinCallDesignator*(x: BuiltinCallDesignator);
  93. PROCEDURE ^ VisitTypeGuardDesignator*(x: TypeGuardDesignator);
  94. PROCEDURE ^ VisitDereferenceDesignator*(x: DereferenceDesignator);
  95. PROCEDURE ^ VisitSupercallDesignator*(x: SupercallDesignator);
  96. PROCEDURE ^ VisitSelfDesignator*(x: SelfDesignator);
  97. PROCEDURE ^ VisitResultDesignator*(x: ResultDesignator);
  98. PROCEDURE ^ VisitValue*(x: Value);
  99. PROCEDURE ^ VisitBooleanValue*(x: BooleanValue);
  100. PROCEDURE ^ VisitIntegerValue*(x: IntegerValue);
  101. PROCEDURE ^ VisitCharacterValue*(x: CharacterValue);
  102. PROCEDURE ^ VisitSetValue*(x: SetValue);
  103. PROCEDURE ^ VisitMathArrayValue*(x: MathArrayValue);
  104. PROCEDURE ^ VisitRealValue*(x: RealValue);
  105. PROCEDURE ^ VisitComplexValue*(x: ComplexValue);
  106. PROCEDURE ^ VisitStringValue*(x: StringValue);
  107. PROCEDURE ^ VisitNilValue*(x: NilValue);
  108. PROCEDURE ^ VisitEnumerationValue*(x: EnumerationValue);
  109. PROCEDURE ^ VisitSymbol*(x: Symbol);
  110. PROCEDURE ^ VisitModule*(x: Module);
  111. PROCEDURE ^ VisitTypeDeclaration*(x: TypeDeclaration);
  112. PROCEDURE ^ VisitConstant*(x: Constant);
  113. PROCEDURE ^ VisitVariable*(x: Variable);
  114. PROCEDURE ^ VisitParameter*(x: Parameter);
  115. PROCEDURE ^ VisitProperty*(x: Property);
  116. PROCEDURE ^ VisitProcedure*(x: Procedure);
  117. PROCEDURE ^ VisitBuiltin*(x: Builtin);
  118. PROCEDURE ^ VisitOperator*(x: Operator);
  119. PROCEDURE ^ VisitImport*(x: Import);
  120. PROCEDURE ^ VisitStatement*(x: Statement);
  121. PROCEDURE ^ VisitProcedureCallStatement*(x: ProcedureCallStatement);
  122. PROCEDURE ^ VisitAssignment*(x: Assignment);
  123. PROCEDURE ^ VisitCommunicationStatement*(x: CommunicationStatement);
  124. PROCEDURE ^ VisitIfStatement*(x: IfStatement);
  125. PROCEDURE ^ VisitWithStatement*(x: WithStatement);
  126. PROCEDURE ^ VisitCaseStatement*(x: CaseStatement);
  127. PROCEDURE ^ VisitWhileStatement*(x: WhileStatement);
  128. PROCEDURE ^ VisitRepeatStatement*(x: RepeatStatement);
  129. PROCEDURE ^ VisitForStatement*(x: ForStatement);
  130. PROCEDURE ^ VisitLoopStatement*(x: LoopStatement);
  131. PROCEDURE ^ VisitExitableBlock*(x: ExitableBlock);
  132. PROCEDURE ^ VisitExitStatement*(x: ExitStatement);
  133. PROCEDURE ^ VisitReturnStatement*(x: ReturnStatement);
  134. PROCEDURE ^ VisitAwaitStatement*(x: AwaitStatement);
  135. PROCEDURE ^ VisitStatementBlock*(x: StatementBlock);
  136. PROCEDURE ^ VisitCode*(x: Code);
  137. END Visitor;
  138. ArrayAccessOperators* = RECORD
  139. len*: Operator;
  140. generalRead*, generalWrite*: Operator;
  141. read*, write*: POINTER TO ARRAY OF Operator;
  142. END;
  143. FingerPrint* = RECORD
  144. shallow*, public*, private*: LONGINT;
  145. shallowAvailable*, deepAvailable*: BOOLEAN;
  146. END;
  147. Identifier* = Basic.String;
  148. QualifiedIdentifier* = OBJECT
  149. VAR
  150. prefix-, suffix-: Identifier;
  151. position-: Position;
  152. PROCEDURE ^ & InitQualifiedIdentifier(position: Position; prefix, suffix: Identifier);
  153. PROCEDURE ^ GetName*(VAR name: Basic.SegmentedName);
  154. END QualifiedIdentifier;
  155. Type* = OBJECT
  156. VAR
  157. typeDeclaration-: TypeDeclaration;
  158. scope-: Scope;
  159. resolved-: Type;
  160. position-: Position;
  161. state-: SET;
  162. hasPointers-: BOOLEAN;
  163. fingerprint-: FingerPrint;
  164. isRealtime-: BOOLEAN;
  165. recursion: BOOLEAN;
  166. sizeInBits-: LONGINT;
  167. alignmentInBits-: LONGINT;
  168. PROCEDURE ^ & InitType*(position: Position);
  169. PROCEDURE ^ SetSize*(sizeInBits: LONGINT);
  170. PROCEDURE ^ SetAlignmentInBits*(alignmentInBits: LONGINT);
  171. PROCEDURE ^ End*(position: LONGINT);
  172. PROCEDURE ^ SetFingerPrint*(CONST fp: FingerPrint);
  173. PROCEDURE ^ SetState*(state: LONGINT);
  174. PROCEDURE ^ SetHasPointers*(has: BOOLEAN);
  175. PROCEDURE ^ RemoveState*(state: LONGINT);
  176. PROCEDURE ^ SetTypeDeclaration*(typeDeclaration: TypeDeclaration);
  177. PROCEDURE ^ SetScope*(scope: Scope);
  178. PROCEDURE ^ SetRealtime*(isRealtime: BOOLEAN);
  179. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  180. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  181. PROCEDURE ^ IsPointer*(): BOOLEAN;
  182. PROCEDURE ^ IsComposite*(): BOOLEAN;
  183. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  184. PROCEDURE ^ Accept*(v: Visitor);
  185. PROCEDURE ^ IsRecordType*(): BOOLEAN;
  186. END Type;
  187. BasicType* = OBJECT (Type)
  188. VAR
  189. name-: Identifier;
  190. PROCEDURE ^ & InitBasicType(CONST id: ARRAY OF CHAR; sizeInBits: LONGINT);
  191. PROCEDURE ^ SetName*(CONST id: ARRAY OF CHAR);
  192. PROCEDURE ^ SetTypeDeclaration*(typeDeclaration: TypeDeclaration);
  193. PROCEDURE ^ Accept*(v: Visitor);
  194. END BasicType;
  195. ObjectType* = OBJECT (BasicType)
  196. PROCEDURE ^ & InitObjectType(sizeInBits: LONGINT);
  197. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  198. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  199. PROCEDURE ^ Accept*(v: Visitor);
  200. PROCEDURE ^ IsPointer*(): BOOLEAN;
  201. END ObjectType;
  202. NilType* = OBJECT (BasicType)
  203. PROCEDURE ^ & InitNilType(sizeInBits: LONGINT);
  204. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  205. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  206. PROCEDURE ^ IsPointer*(): BOOLEAN;
  207. PROCEDURE ^ Accept*(v: Visitor);
  208. END NilType;
  209. AnyType* = OBJECT (BasicType)
  210. PROCEDURE ^ & InitAnyType(sizeInBits: LONGINT);
  211. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  212. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  213. PROCEDURE ^ IsPointer*(): BOOLEAN;
  214. PROCEDURE ^ Accept*(v: Visitor);
  215. END AnyType;
  216. ByteType* = OBJECT (BasicType)
  217. PROCEDURE ^ & InitByteType(sizeInBits: LONGINT);
  218. PROCEDURE ^ Accept*(v: Visitor);
  219. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  220. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  221. END ByteType;
  222. AddressType* = OBJECT (BasicType)
  223. PROCEDURE ^ & InitAddressType(sizeInBits: LONGINT);
  224. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  225. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  226. PROCEDURE ^ Accept*(v: Visitor);
  227. END AddressType;
  228. SizeType* = OBJECT (BasicType)
  229. PROCEDURE ^ & InitSizeType(sizeInBits: LONGINT);
  230. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  231. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  232. PROCEDURE ^ Accept*(v: Visitor);
  233. END SizeType;
  234. BooleanType* = OBJECT (BasicType)
  235. PROCEDURE ^ & InitBooleanType(sizeInBits: LONGINT);
  236. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  237. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  238. PROCEDURE ^ Accept*(v: Visitor);
  239. END BooleanType;
  240. SetType* = OBJECT (BasicType)
  241. PROCEDURE ^ & InitSetType(sizeInBits: LONGINT);
  242. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  243. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  244. PROCEDURE ^ Accept*(v: Visitor);
  245. END SetType;
  246. CharacterType* = OBJECT (BasicType)
  247. PROCEDURE ^ & InitCharacterType(sizeInBits: LONGINT);
  248. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  249. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  250. PROCEDURE ^ Accept*(v: Visitor);
  251. END CharacterType;
  252. RangeType* = OBJECT (BasicType)
  253. PROCEDURE ^ & InitRangeType(sizeInBits: LONGINT);
  254. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  255. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  256. PROCEDURE ^ IsComposite*(): BOOLEAN;
  257. PROCEDURE ^ Accept*(v: Visitor);
  258. END RangeType;
  259. NumberType* = OBJECT (BasicType)
  260. PROCEDURE ^ & InitNumberType(CONST name: ARRAY OF CHAR; sizeInBits: LONGINT);
  261. END NumberType;
  262. IntegerType* = OBJECT (NumberType)
  263. VAR
  264. signed-: BOOLEAN;
  265. PROCEDURE ^ & InitIntegerType(sizeInBits: LONGINT; signed: BOOLEAN);
  266. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  267. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  268. PROCEDURE ^ Accept*(v: Visitor);
  269. END IntegerType;
  270. FloatType* = OBJECT (NumberType)
  271. PROCEDURE ^ & InitFloatType(sizeInBits: LONGINT);
  272. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  273. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  274. PROCEDURE ^ Accept*(v: Visitor);
  275. END FloatType;
  276. ComplexType* = OBJECT (NumberType)
  277. VAR
  278. componentType-: Type;
  279. PROCEDURE ^ & InitComplexType(componentType: Type);
  280. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  281. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  282. PROCEDURE ^ IsComposite*(): BOOLEAN;
  283. PROCEDURE ^ Accept*(v: Visitor);
  284. END ComplexType;
  285. QualifiedType* = OBJECT (Type)
  286. VAR
  287. qualifiedIdentifier-: QualifiedIdentifier;
  288. PROCEDURE ^ & InitQualifiedType(position: Position; scope: Scope; qualifiedIdentifier: QualifiedIdentifier);
  289. PROCEDURE ^ SetResolved*(resolved: Type);
  290. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  291. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  292. PROCEDURE ^ IsPointer*(): BOOLEAN;
  293. PROCEDURE ^ IsComposite*(): BOOLEAN;
  294. PROCEDURE ^ Accept*(v: Visitor);
  295. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  296. PROCEDURE ^ IsRecordType*(): BOOLEAN;
  297. END QualifiedType;
  298. StringType* = OBJECT (Type)
  299. VAR
  300. length-: LONGINT;
  301. baseType-: Type;
  302. PROCEDURE ^ & InitStringType(position: Position; baseType: Type; length: LONGINT);
  303. PROCEDURE ^ SetLength*(length: LONGINT);
  304. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  305. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  306. PROCEDURE ^ IsComposite*(): BOOLEAN;
  307. PROCEDURE ^ Accept*(v: Visitor);
  308. END StringType;
  309. EnumerationType* = OBJECT (Type)
  310. VAR
  311. enumerationScope-: EnumerationScope;
  312. enumerationBase-: Type;
  313. rangeLowest-, rangeHighest-: LONGINT;
  314. PROCEDURE ^ & InitEnumerationType(position: Position; scope: Scope; enumerationScope: EnumerationScope);
  315. PROCEDURE ^ SetEnumerationBase*(base: Type);
  316. PROCEDURE ^ SetRange*(lowest, highest: LONGINT);
  317. PROCEDURE ^ Extends*(this: EnumerationType): BOOLEAN;
  318. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  319. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  320. PROCEDURE ^ Accept*(v: Visitor);
  321. END EnumerationType;
  322. ArrayType* = OBJECT (Type)
  323. VAR
  324. arrayBase-: Type;
  325. length-: Expression;
  326. staticLength-: LONGINT;
  327. form-: LONGINT;
  328. PROCEDURE ^ & InitArrayType(position: Position; scope: Scope; form: LONGINT);
  329. PROCEDURE ^ SetArrayBase*(type: Type);
  330. PROCEDURE ^ SetForm*(f: LONGINT);
  331. PROCEDURE ^ SetLength*(length: Expression);
  332. PROCEDURE ^ Child*(nr: LONGINT): Type;
  333. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  334. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  335. PROCEDURE ^ IsComposite*(): BOOLEAN;
  336. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  337. PROCEDURE ^ Accept*(v: Visitor);
  338. END ArrayType;
  339. MathArrayType* = OBJECT (Type)
  340. VAR
  341. arrayBase-: Type;
  342. length-: Expression;
  343. staticLength-: LONGINT;
  344. staticIncrementInBits-: LONGINT;
  345. form-: LONGINT;
  346. PROCEDURE ^ & InitMathArrayType(position: Position; scope: Scope; form: LONGINT);
  347. PROCEDURE ^ SetForm*(form: LONGINT);
  348. PROCEDURE ^ SetArrayBase*(type: Type);
  349. PROCEDURE ^ SetLength*(length: Expression);
  350. PROCEDURE ^ SetIncrement*(increment: LONGINT);
  351. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  352. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  353. PROCEDURE ^ ElementType*(): Type;
  354. PROCEDURE ^ Dimensionality*(): LONGINT;
  355. PROCEDURE ^ IsFullyDynamic*(): BOOLEAN;
  356. PROCEDURE ^ IsComposite*(): BOOLEAN;
  357. PROCEDURE ^ Accept*(v: Visitor);
  358. END MathArrayType;
  359. PointerType* = OBJECT (Type)
  360. VAR
  361. modifiers-: Modifier;
  362. pointerBase-: Type;
  363. isPlain-: BOOLEAN;
  364. isUnsafe-: BOOLEAN;
  365. isDisposable-: BOOLEAN;
  366. isHidden-: BOOLEAN;
  367. PROCEDURE ^ & InitPointerType(position: Position; scope: Scope);
  368. PROCEDURE ^ SetHidden*(hidden: BOOLEAN);
  369. PROCEDURE ^ SetModifiers*(flags: Modifier);
  370. PROCEDURE ^ SetPointerBase*(type: Type);
  371. PROCEDURE ^ SetPlain*(plain: BOOLEAN);
  372. PROCEDURE ^ SetUnsafe*(unsafe: BOOLEAN);
  373. PROCEDURE ^ SetDisposable*(disposable: BOOLEAN);
  374. PROCEDURE ^ Extends*(this: Type): BOOLEAN;
  375. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  376. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  377. PROCEDURE ^ IsPointer*(): BOOLEAN;
  378. PROCEDURE ^ Accept*(v: Visitor);
  379. END PointerType;
  380. PortType* = OBJECT (Type)
  381. VAR
  382. direction-: LONGINT;
  383. sizeExpression-: Expression;
  384. sizeInBits-: LONGINT;
  385. cellsAreObjects-: BOOLEAN;
  386. PROCEDURE ^ & InitPortType(position: Position; direction: LONGINT; sizeExpression: Expression; scope: Scope);
  387. PROCEDURE ^ SetSize*(size: LONGINT);
  388. PROCEDURE ^ SetSizeExpression*(sizeExpression: Expression);
  389. PROCEDURE ^ SetCellsAreObjects*(b: BOOLEAN);
  390. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  391. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  392. PROCEDURE ^ IsPointer*(): BOOLEAN;
  393. PROCEDURE ^ Accept*(v: Visitor);
  394. END PortType;
  395. RecordType* = OBJECT (Type)
  396. VAR
  397. recordScope-: RecordScope;
  398. baseType-: Type;
  399. pointerType-: PointerType;
  400. modifiers-: Modifier;
  401. isObject-, isProtected: BOOLEAN;
  402. arrayStructure-: MathArrayType;
  403. arrayAccessOperators-: ArrayAccessOperators;
  404. PROCEDURE ^ & InitRecordType(position: Position; scope: Scope; recordScope: RecordScope);
  405. PROCEDURE ^ SetModifiers*(flag: Modifier);
  406. PROCEDURE ^ SetBaseType*(type: Type);
  407. PROCEDURE ^ SetPointerType*(pointerType: PointerType);
  408. PROCEDURE ^ IsObject*(isObject: BOOLEAN);
  409. PROCEDURE ^ IsActive*(): BOOLEAN;
  410. PROCEDURE ^ IsProtected*(): BOOLEAN;
  411. PROCEDURE ^ SetProtected*(protected: BOOLEAN);
  412. PROCEDURE ^ Level*(): LONGINT;
  413. PROCEDURE ^ GetBaseRecord*(): RecordType;
  414. PROCEDURE ^ Extends*(this: Type): BOOLEAN;
  415. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  416. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  417. PROCEDURE ^ SetArrayStructure*(arrayStructure: MathArrayType);
  418. PROCEDURE ^ SetArrayAccessOperators*(arrayAccessOperators: ArrayAccessOperators);
  419. PROCEDURE ^ HasArrayStructure*(): BOOLEAN;
  420. PROCEDURE ^ IsComposite*(): BOOLEAN;
  421. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  422. PROCEDURE ^ Accept*(v: Visitor);
  423. PROCEDURE ^ IsRecordType*(): BOOLEAN;
  424. END RecordType;
  425. CellType* = OBJECT (Type)
  426. VAR
  427. firstParameter-, lastParameter-: Parameter;
  428. numberParameters-: LONGINT;
  429. firstProperty-, lastProperty-: Property;
  430. numberProperties: LONGINT;
  431. cellScope-: CellScope;
  432. isCellNet-: BOOLEAN;
  433. modifiers-: Modifier;
  434. baseType-: Type;
  435. PROCEDURE ^ & InitCellType(position: Position; scope: Scope; cellScope: CellScope);
  436. PROCEDURE ^ SetBaseType*(base: Type);
  437. PROCEDURE ^ GetBaseValueType*(): Type;
  438. PROCEDURE ^ GetBaseRecord*(): RecordType;
  439. PROCEDURE ^ AddParameter*(p: Parameter);
  440. PROCEDURE ^ AddProperty*(p: Property);
  441. PROCEDURE ^ FindParameter*(identifier: Identifier): Parameter;
  442. PROCEDURE ^ FindProperty*(identifier: Identifier): Property;
  443. PROCEDURE ^ SetModifiers*(flag: Modifier);
  444. PROCEDURE ^ IsCellNet*(t: BOOLEAN);
  445. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  446. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  447. PROCEDURE ^ IsComposite*(): BOOLEAN;
  448. PROCEDURE ^ Accept*(v: Visitor);
  449. END CellType;
  450. ProcedureType* = OBJECT (Type)
  451. VAR
  452. modifiers-: Modifier;
  453. returnType-: Type;
  454. returnTypeModifiers-: Modifier;
  455. hasUntracedReturn-: BOOLEAN;
  456. firstParameter-, lastParameter-: Parameter;
  457. numberParameters-: LONGINT;
  458. returnParameter-: Parameter;
  459. isDelegate-, isInterrupt-, noPAF-, noReturn-: BOOLEAN;
  460. pcOffset-: LONGINT;
  461. callingConvention-: CallingConvention;
  462. stackAlignment-: LONGINT;
  463. parametersOffset-: LONGINT;
  464. PROCEDURE ^ & InitProcedureType(position: Position; scope: Scope);
  465. PROCEDURE ^ SetNoPAF*(noPAF: BOOLEAN);
  466. PROCEDURE ^ SetNoReturn*(noReturn: BOOLEAN);
  467. PROCEDURE ^ SetPcOffset*(pcOffset: LONGINT);
  468. PROCEDURE ^ SetInterrupt*(isInterrupt: BOOLEAN);
  469. PROCEDURE ^ SetModifiers*(flags: Modifier);
  470. PROCEDURE ^ SetReturnTypeModifiers*(flags: Modifier);
  471. PROCEDURE ^ SetDelegate*(delegate: BOOLEAN);
  472. PROCEDURE ^ SetUntracedReturn*(untraced: BOOLEAN);
  473. PROCEDURE ^ SetStackAlignment*(alignment: LONGINT);
  474. PROCEDURE ^ SetParametersOffset*(ofs: LONGINT);
  475. PROCEDURE ^ SetReturnParameter*(parameter: Parameter);
  476. PROCEDURE ^ SetCallingConvention*(cc: CallingConvention);
  477. PROCEDURE ^ AddParameter*(p: Parameter);
  478. PROCEDURE ^ RevertParameters*;
  479. PROCEDURE ^ SetReturnType*(type: Type);
  480. PROCEDURE ^ SameType*(this: Type): BOOLEAN;
  481. PROCEDURE ^ CompatibleTo*(to: Type): BOOLEAN;
  482. PROCEDURE ^ IsComposite*(): BOOLEAN;
  483. PROCEDURE ^ Accept*(v: Visitor);
  484. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  485. END ProcedureType;
  486. Expression* = OBJECT
  487. VAR
  488. type-: Type;
  489. assignable-: BOOLEAN;
  490. position-: Position;
  491. state-: SET;
  492. resolved-: Value;
  493. isHidden-: BOOLEAN;
  494. PROCEDURE ^ End*(position: LONGINT);
  495. PROCEDURE ^ SetState*(state: LONGINT);
  496. PROCEDURE ^ & InitExpression(position: Position);
  497. PROCEDURE ^ SetHidden*(hidden: BOOLEAN);
  498. PROCEDURE ^ SetType*(type: Type);
  499. PROCEDURE ^ SetResolved*(value: Value);
  500. PROCEDURE ^ SetAssignable*(assignable: BOOLEAN);
  501. PROCEDURE ^ Clone(): Expression;
  502. PROCEDURE ^ Accept*(v: Visitor);
  503. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  504. END Expression;
  505. ExpressionList* = OBJECT
  506. VAR
  507. list: Basic.List;
  508. PROCEDURE ^ & InitList;
  509. PROCEDURE ^ Length*(): LONGINT;
  510. PROCEDURE ^ AddExpression*(d: Expression);
  511. PROCEDURE ^ GetExpression*(index: LONGINT): Expression;
  512. PROCEDURE ^ SetExpression*(index: LONGINT; expression: Expression);
  513. PROCEDURE ^ RemoveExpression*(i: LONGINT);
  514. PROCEDURE ^ Revert*;
  515. PROCEDURE ^ Clone*(VAR list: ExpressionList);
  516. END ExpressionList;
  517. Set* = OBJECT (Expression)
  518. VAR
  519. elements-: ExpressionList;
  520. PROCEDURE ^ & InitSet(position: Position);
  521. PROCEDURE ^ Clone(): Expression;
  522. PROCEDURE ^ Accept*(v: Visitor);
  523. END Set;
  524. MathArrayExpression* = OBJECT (Expression)
  525. VAR
  526. elements-: ExpressionList;
  527. PROCEDURE ^ & InitMathArrayExpression(position: Position);
  528. PROCEDURE ^ Clone(): Expression;
  529. PROCEDURE ^ Accept*(v: Visitor);
  530. END MathArrayExpression;
  531. UnaryExpression* = OBJECT (Expression)
  532. VAR
  533. left-: Expression;
  534. operator-: LONGINT;
  535. PROCEDURE ^ & InitUnaryExpression(position: Position; operand: Expression; operator: LONGINT);
  536. PROCEDURE ^ SetLeft*(left: Expression);
  537. PROCEDURE ^ Clone(): Expression;
  538. PROCEDURE ^ Accept*(v: Visitor);
  539. END UnaryExpression;
  540. BinaryExpression* = OBJECT (Expression)
  541. VAR
  542. left-, right-: Expression;
  543. operator-: LONGINT;
  544. PROCEDURE ^ & InitBinaryExpression(position: Position; left, right: Expression; operator: LONGINT);
  545. PROCEDURE ^ SetLeft*(left: Expression);
  546. PROCEDURE ^ SetRight*(right: Expression);
  547. PROCEDURE ^ Clone(): Expression;
  548. PROCEDURE ^ Accept*(v: Visitor);
  549. END BinaryExpression;
  550. RangeExpression* = OBJECT (Expression)
  551. VAR
  552. first-, last-, step-: Expression;
  553. missingFirst-, missingLast-, missingStep-: BOOLEAN;
  554. context-: SHORTINT;
  555. PROCEDURE ^ & InitRangeExpression(position: Position; first, last, step: Expression);
  556. PROCEDURE ^ SetFirst*(first: Expression);
  557. PROCEDURE ^ SetLast*(last: Expression);
  558. PROCEDURE ^ SetStep*(step: Expression);
  559. PROCEDURE ^ SetContext*(context: SHORTINT);
  560. PROCEDURE ^ Clone(): Expression;
  561. PROCEDURE ^ Accept*(v: Visitor);
  562. END RangeExpression;
  563. TensorRangeExpression* = OBJECT (Expression)
  564. PROCEDURE ^ & InitTensorRangeExpression(position: Position);
  565. PROCEDURE ^ Clone(): Expression;
  566. PROCEDURE ^ Accept*(v: Visitor);
  567. END TensorRangeExpression;
  568. Conversion* = OBJECT (Expression)
  569. VAR
  570. expression-: Expression;
  571. typeExpression-: Expression;
  572. PROCEDURE ^ & InitConversion(position: Position; expression: Expression; type: Type; typeExpression: Expression);
  573. PROCEDURE ^ SetExpression*(expression: Expression);
  574. PROCEDURE ^ Clone(): Expression;
  575. PROCEDURE ^ Accept*(v: Visitor);
  576. END Conversion;
  577. Designator* = OBJECT (Expression)
  578. VAR
  579. left-: Expression;
  580. relatedRhs-: Expression;
  581. relatedAsot-: Expression;
  582. relatedIndexList-: ExpressionList;
  583. modifiers-: Modifier;
  584. PROCEDURE ^ & InitDesignator*(position: Position);
  585. PROCEDURE ^ SetLeft*(expression: Expression);
  586. PROCEDURE ^ SetRelatedRhs*(relatedRhs: Expression);
  587. PROCEDURE ^ SetRelatedAsot*(relatedAsot: Expression);
  588. PROCEDURE ^ SetRelatedIndexList*(relatedIndexList: ExpressionList);
  589. PROCEDURE ^ SetModifiers*(flags: Modifier);
  590. PROCEDURE ^ Clone(): Expression;
  591. PROCEDURE ^ Accept*(v: Visitor);
  592. END Designator;
  593. IdentifierDesignator* = OBJECT (Designator)
  594. VAR
  595. identifier-: Identifier;
  596. PROCEDURE ^ & InitIdentifierDesignator(position: Position; id: Identifier);
  597. PROCEDURE ^ Clone(): Expression;
  598. PROCEDURE ^ Accept*(v: Visitor);
  599. END IdentifierDesignator;
  600. SelectorDesignator* = OBJECT (Designator)
  601. VAR
  602. identifier-: Identifier;
  603. PROCEDURE ^ & InitSelector(position: Position; left: Designator; identifier: Identifier);
  604. PROCEDURE ^ Clone(): Expression;
  605. PROCEDURE ^ Accept*(v: Visitor);
  606. END SelectorDesignator;
  607. ParameterDesignator* = OBJECT (Designator)
  608. VAR
  609. parameters-: ExpressionList;
  610. PROCEDURE ^ & InitParameterDesignator(position: Position; left: Designator; parameters: ExpressionList);
  611. PROCEDURE ^ Clone(): Expression;
  612. PROCEDURE ^ Accept*(v: Visitor);
  613. END ParameterDesignator;
  614. ArrowDesignator* = OBJECT (Designator)
  615. PROCEDURE ^ & InitArrowDesignator(position: Position; left: Designator);
  616. PROCEDURE ^ Clone(): Expression;
  617. PROCEDURE ^ Accept*(v: Visitor);
  618. END ArrowDesignator;
  619. BracketDesignator* = OBJECT (Designator)
  620. VAR
  621. parameters-: ExpressionList;
  622. PROCEDURE ^ & InitBracketDesignator(position: Position; left: Designator; parameters: ExpressionList);
  623. PROCEDURE ^ Clone(): Expression;
  624. PROCEDURE ^ Accept*(v: Visitor);
  625. END BracketDesignator;
  626. SymbolDesignator* = OBJECT (Designator)
  627. VAR
  628. symbol-: Symbol;
  629. PROCEDURE ^ & InitSymbolDesignator(position: Position; left: Designator; symbol: Symbol);
  630. PROCEDURE ^ Accept*(v: Visitor);
  631. PROCEDURE ^ Clone(): Expression;
  632. PROCEDURE ^ SetSymbol*(s: Symbol);
  633. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  634. END SymbolDesignator;
  635. IndexDesignator* = OBJECT (Designator)
  636. VAR
  637. parameters-: ExpressionList;
  638. hasRange-: BOOLEAN;
  639. hasTensorRange-: BOOLEAN;
  640. PROCEDURE ^ & InitIndexDesignator(position: Position; left: Designator);
  641. PROCEDURE ^ HasRange*;
  642. PROCEDURE ^ HasTensorRange*;
  643. PROCEDURE ^ Clone(): Expression;
  644. PROCEDURE ^ Accept*(v: Visitor);
  645. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  646. END IndexDesignator;
  647. StatementDesignator* = OBJECT (Designator)
  648. VAR
  649. statement-: Statement;
  650. result-: Expression;
  651. PROCEDURE ^ & InitStatementDesignator(position: Position; s: Statement);
  652. PROCEDURE ^ Clone(): Expression;
  653. PROCEDURE ^ SetResult*(r: Expression);
  654. PROCEDURE ^ Accept*(v: Visitor);
  655. END StatementDesignator;
  656. ProcedureCallDesignator* = OBJECT (Designator)
  657. VAR
  658. parameters-: ExpressionList;
  659. PROCEDURE ^ & InitProcedureCallDesignator(position: Position; left: Designator; parameters: ExpressionList);
  660. PROCEDURE ^ Clone(): Expression;
  661. PROCEDURE ^ Accept*(v: Visitor);
  662. END ProcedureCallDesignator;
  663. BuiltinCallDesignator* = OBJECT (Designator)
  664. VAR
  665. id-: LONGINT;
  666. parameters-: ExpressionList;
  667. builtin-: Builtin;
  668. returnType-: Type;
  669. PROCEDURE ^ & InitBuiltinCallDesignator(position: Position; id: LONGINT; left: Designator; parameters: ExpressionList);
  670. PROCEDURE ^ SetReturnType*(type: Type);
  671. PROCEDURE ^ Clone(): Expression;
  672. PROCEDURE ^ Accept*(v: Visitor);
  673. END BuiltinCallDesignator;
  674. TypeGuardDesignator* = OBJECT (Designator)
  675. VAR
  676. typeExpression-: Expression;
  677. PROCEDURE ^ & InitTypeGuardDesignator(position: Position; left: Designator; type: Type);
  678. PROCEDURE ^ SetTypeExpression*(typeExpression: Expression);
  679. PROCEDURE ^ Clone(): Expression;
  680. PROCEDURE ^ Accept*(v: Visitor);
  681. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  682. END TypeGuardDesignator;
  683. DereferenceDesignator* = OBJECT (Designator)
  684. PROCEDURE ^ & InitDereferenceDesignator(position: Position; left: Designator);
  685. PROCEDURE ^ Clone(): Expression;
  686. PROCEDURE ^ Accept*(v: Visitor);
  687. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  688. END DereferenceDesignator;
  689. SupercallDesignator* = OBJECT (Designator)
  690. PROCEDURE ^ & InitSupercallDesignator(position: Position; left: Designator);
  691. PROCEDURE ^ Clone(): Expression;
  692. PROCEDURE ^ Accept*(v: Visitor);
  693. END SupercallDesignator;
  694. SelfDesignator* = OBJECT (Designator)
  695. PROCEDURE ^ & InitSelfDesignator(position: Position);
  696. PROCEDURE ^ Clone(): Expression;
  697. PROCEDURE ^ Accept*(v: Visitor);
  698. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  699. END SelfDesignator;
  700. ResultDesignator* = OBJECT (Designator)
  701. PROCEDURE ^ & InitResultDesignator(position: Position);
  702. PROCEDURE ^ Clone(): Expression;
  703. PROCEDURE ^ Accept*(v: Visitor);
  704. END ResultDesignator;
  705. Value* = OBJECT (Expression)
  706. VAR
  707. fingerprint-: FingerPrint;
  708. PROCEDURE ^ & InitValue(position: Position);
  709. PROCEDURE ^ SetFingerPrint*(CONST fp: FingerPrint);
  710. PROCEDURE ^ Accept*(v: Visitor);
  711. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  712. END Value;
  713. BooleanValue* = OBJECT (Value)
  714. VAR
  715. value-: BOOLEAN;
  716. PROCEDURE ^ & InitBooleanValue(position: Position; value: BOOLEAN);
  717. PROCEDURE ^ SetValue*(value: BOOLEAN);
  718. PROCEDURE ^ Clone(): Expression;
  719. PROCEDURE ^ Accept*(v: Visitor);
  720. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  721. END BooleanValue;
  722. IntegerValue* = OBJECT (Value)
  723. VAR
  724. hvalue-: HUGEINT;
  725. value-: LONGINT;
  726. PROCEDURE ^ & InitIntegerValue(position: Position; hvalue: HUGEINT);
  727. PROCEDURE ^ SetValue*(hvalue: HUGEINT);
  728. PROCEDURE ^ Clone(): Expression;
  729. PROCEDURE ^ Accept*(v: Visitor);
  730. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  731. END IntegerValue;
  732. CharacterValue* = OBJECT (Value)
  733. VAR
  734. value-: CHAR;
  735. PROCEDURE ^ & InitCharacterValue(position: Position; value: CHAR);
  736. PROCEDURE ^ SetValue*(value: CHAR);
  737. PROCEDURE ^ Clone(): Expression;
  738. PROCEDURE ^ Accept*(v: Visitor);
  739. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  740. END CharacterValue;
  741. SetValueType = SetValue;
  742. SetValue* = OBJECT (Value)
  743. VAR
  744. value-: SET;
  745. PROCEDURE ^ & InitSetValue(position: Position; value: SET);
  746. PROCEDURE ^ SetValue*(value: SET);
  747. PROCEDURE ^ Clone(): Expression;
  748. PROCEDURE ^ Accept*(v: Visitor);
  749. END SetValue;
  750. MathArrayValue* = OBJECT (Value)
  751. VAR
  752. array-: MathArrayExpression;
  753. PROCEDURE ^ & InitMathArrayValue(position: Position);
  754. PROCEDURE ^ SetArray*(array: MathArrayExpression);
  755. PROCEDURE ^ Clone(): Expression;
  756. PROCEDURE ^ Accept*(v: Visitor);
  757. END MathArrayValue;
  758. RealValue* = OBJECT (Value)
  759. VAR
  760. value-: LONGREAL;
  761. subtype-: LONGINT;
  762. PROCEDURE ^ & InitRealValue(position: Position; value: LONGREAL);
  763. PROCEDURE ^ SetValue*(value: LONGREAL);
  764. PROCEDURE ^ SetSubtype*(subtype: LONGINT);
  765. PROCEDURE ^ Clone(): Expression;
  766. PROCEDURE ^ Accept*(v: Visitor);
  767. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  768. END RealValue;
  769. ComplexValue* = OBJECT (Value)
  770. VAR
  771. realValue-, imagValue-: LONGREAL;
  772. subtype-: LONGINT;
  773. PROCEDURE ^ & InitComplexValue(position: Position; realValue, imagValue: LONGREAL);
  774. PROCEDURE ^ SetValue*(realValue, imagValue: LONGREAL);
  775. PROCEDURE ^ UpdateSubtype*;
  776. PROCEDURE ^ SetSubtype*(subtype: LONGINT);
  777. PROCEDURE ^ Clone(): Expression;
  778. PROCEDURE ^ Accept*(v: Visitor);
  779. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  780. END ComplexValue;
  781. StringValue* = OBJECT (Value)
  782. VAR
  783. value-: String;
  784. length-: LONGINT;
  785. PROCEDURE ^ & InitStringValue(position: Position; value: String);
  786. PROCEDURE ^ SetValue*(CONST value: String);
  787. PROCEDURE ^ Append*(CONST value: String);
  788. PROCEDURE ^ AppendChar*(CONST ch: CHAR);
  789. PROCEDURE ^ Clone(): Expression;
  790. PROCEDURE ^ Accept*(v: Visitor);
  791. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  792. END StringValue;
  793. NilValue* = OBJECT (Value)
  794. PROCEDURE ^ Accept*(v: Visitor);
  795. PROCEDURE ^ Clone(): Expression;
  796. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  797. END NilValue;
  798. EnumerationValue* = OBJECT (Value)
  799. VAR
  800. value-: LONGINT;
  801. PROCEDURE ^ & InitEnumerationValue(position: Position; value: LONGINT);
  802. PROCEDURE ^ SetValue*(value: LONGINT);
  803. PROCEDURE ^ Clone(): Expression;
  804. PROCEDURE ^ Accept*(v: Visitor);
  805. PROCEDURE ^ Equals*(v: Value): BOOLEAN;
  806. END EnumerationValue;
  807. Symbol* = OBJECT
  808. VAR
  809. nextSymbol-: Symbol;
  810. name-: Identifier;
  811. externalName-: Scanner.StringType;
  812. access-: SET;
  813. type-: Type;
  814. scope-: Scope;
  815. offsetInBits-: LONGINT;
  816. used-, written-: BOOLEAN;
  817. fixed-: BOOLEAN;
  818. alignment-: LONGINT;
  819. position-: Position;
  820. state-: SET;
  821. fingerprint-: FingerPrint;
  822. comment-: Comment;
  823. PROCEDURE ^ & InitSymbol(position: Position; name: Identifier);
  824. PROCEDURE ^ SetAlignment*(fix: BOOLEAN; align: LONGINT);
  825. PROCEDURE ^ SetFingerPrint*(CONST fp: FingerPrint);
  826. PROCEDURE ^ SetState*(state: LONGINT);
  827. PROCEDURE ^ SetScope*(scope: Scope);
  828. PROCEDURE ^ SetType*(type: Type);
  829. PROCEDURE ^ SetNext*(symbol: Symbol);
  830. PROCEDURE ^ SetAccess*(access: SET);
  831. PROCEDURE ^ SetOffset*(ofs: LONGINT);
  832. PROCEDURE ^ MarkUsed*;
  833. PROCEDURE ^ MarkWritten*;
  834. PROCEDURE ^ GetName*(VAR str: ARRAY OF CHAR);
  835. PROCEDURE ^ SetComment*(comment: Comment);
  836. PROCEDURE ^ Accept*(v: Visitor);
  837. PROCEDURE ^ SetExternalName*(name: Scanner.StringType);
  838. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  839. END Symbol;
  840. TypeDeclaration* = OBJECT (Symbol)
  841. VAR
  842. nextTypeDeclaration-: TypeDeclaration;
  843. declaredType-: Type;
  844. PROCEDURE ^ & InitTypeDeclaration(position: Position; name: Identifier);
  845. PROCEDURE ^ SetDeclaredType*(type: Type);
  846. PROCEDURE ^ SetType*(type: Type);
  847. PROCEDURE ^ Accept*(v: Visitor);
  848. END TypeDeclaration;
  849. Constant* = OBJECT (Symbol)
  850. VAR
  851. value-: Expression;
  852. nextConstant-: Constant;
  853. PROCEDURE ^ & InitConstant(position: Position; name: Identifier);
  854. PROCEDURE ^ SetValue*(value: Expression);
  855. PROCEDURE ^ Accept*(v: Visitor);
  856. END Constant;
  857. Variable* = OBJECT (Symbol)
  858. VAR
  859. nextVariable-: Variable;
  860. untraced-: BOOLEAN;
  861. fictive-: BOOLEAN;
  862. fictiveOffset-: LONGINT;
  863. useRegister-: BOOLEAN;
  864. registerNumber-: LONGINT;
  865. modifiers-: Modifier;
  866. initializer-: Expression;
  867. usedAsReference-: BOOLEAN;
  868. PROCEDURE ^ & InitVariable*(position: Position; name: Identifier);
  869. PROCEDURE ^ UsedAsReference*;
  870. PROCEDURE ^ SetUntraced*(u: BOOLEAN);
  871. PROCEDURE ^ SetUseRegister*(u: BOOLEAN);
  872. PROCEDURE ^ SetRegisterNumber*(reg: LONGINT);
  873. PROCEDURE ^ SetFictive*(offset: LONGINT);
  874. PROCEDURE ^ SetModifiers*(flag: Modifier);
  875. PROCEDURE ^ SetInitializer*(initializer: Expression);
  876. PROCEDURE ^ Accept*(v: Visitor);
  877. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  878. END Variable;
  879. Parameter* = OBJECT (Symbol)
  880. VAR
  881. nextParameter-, prevParameter-: Parameter;
  882. modifiers-: Modifier;
  883. defaultValue-: Expression;
  884. kind-: LONGINT;
  885. ownerType-: Type;
  886. untraced-: BOOLEAN;
  887. movable-: BOOLEAN;
  888. PROCEDURE ^ & InitParameter(position: Position; ownerType: Type; name: Identifier; kind: LONGINT);
  889. PROCEDURE ^ SetModifiers*(flag: Modifier);
  890. PROCEDURE ^ SetUntraced*(untraced: BOOLEAN);
  891. PROCEDURE ^ SetMoveable*(movable: BOOLEAN);
  892. PROCEDURE ^ SetDefaultValue*(e: Expression);
  893. PROCEDURE ^ Accept*(v: Visitor);
  894. PROCEDURE ^ SetKind*(kind: LONGINT);
  895. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  896. END Parameter;
  897. Property* = OBJECT (Variable)
  898. VAR
  899. nextProperty-, prevProperty-: Property;
  900. value-: Expression;
  901. PROCEDURE ^ & InitProperty(position: Position; name: Identifier);
  902. PROCEDURE ^ SetValue*(e: Expression);
  903. PROCEDURE ^ Accept*(v: Visitor);
  904. END Property;
  905. Procedure* = OBJECT (Symbol)
  906. VAR
  907. nextProcedure-: Procedure;
  908. procedureScope-: ProcedureScope;
  909. super-: Procedure;
  910. level-, methodNumber-: LONGINT;
  911. isBodyProcedure-, isConstructor-, isFinalizer-, isInline-, isOberonInline-, isEntry-, isExit-, isFinal-, isAbstract-, isOverwritten-: BOOLEAN;
  912. PROCEDURE ^ & InitProcedure(position: Position; name: Identifier; scope: ProcedureScope);
  913. PROCEDURE ^ SetSuper*(super: Procedure);
  914. PROCEDURE ^ SetBodyProcedure*(isBodyProcedure: BOOLEAN);
  915. PROCEDURE ^ SetConstructor*(isConstructor: BOOLEAN);
  916. PROCEDURE ^ SetFinalizer*(isFinalizer: BOOLEAN);
  917. PROCEDURE ^ SetInline*(isInline: BOOLEAN);
  918. PROCEDURE ^ SetOberonInline*(isInline: BOOLEAN);
  919. PROCEDURE ^ SetEntry*(entry: BOOLEAN);
  920. PROCEDURE ^ SetExit*(exit: BOOLEAN);
  921. PROCEDURE ^ SetFinal*(final: BOOLEAN);
  922. PROCEDURE ^ SetOverwritten*(locallyOverwritten: BOOLEAN);
  923. PROCEDURE ^ SetAbstract*(abstract: BOOLEAN);
  924. PROCEDURE ^ SetLevel*(level: LONGINT);
  925. PROCEDURE ^ SetMethodNumber*(methodNumber: LONGINT);
  926. PROCEDURE ^ Accept*(v: Visitor);
  927. END Procedure;
  928. Builtin* = OBJECT (Symbol)
  929. VAR
  930. nextBuiltin-: Builtin;
  931. id-: LONGINT;
  932. PROCEDURE ^ & InitBuiltin(position: Position; name: Identifier; id: LONGINT);
  933. PROCEDURE ^ Accept*(v: Visitor);
  934. END Builtin;
  935. CustomBuiltin* = OBJECT (Builtin)
  936. VAR
  937. subType-: SHORTINT;
  938. PROCEDURE ^ & InitCustomBuiltin(position: Position; name: Identifier; id: LONGINT; subType: SHORTINT);
  939. PROCEDURE ^ CompatibleTo*(otherType: Type): BOOLEAN;
  940. END CustomBuiltin;
  941. Operator* = OBJECT (Procedure)
  942. VAR
  943. nextOperator-: Operator;
  944. isDynamic-: BOOLEAN;
  945. PROCEDURE ^ & InitOperator(position: Position; name: Identifier; scope: ProcedureScope);
  946. PROCEDURE ^ SetDynamic*(isDynamic: BOOLEAN);
  947. PROCEDURE ^ Accept*(v: Visitor);
  948. END Operator;
  949. Import* = OBJECT (Symbol)
  950. VAR
  951. nextImport-: Import;
  952. module-: Module;
  953. moduleName-: Identifier;
  954. context-: Identifier;
  955. direct-: BOOLEAN;
  956. PROCEDURE ^ & InitImport(position: Position; name, moduleName: Identifier; direct: BOOLEAN);
  957. PROCEDURE ^ SetType*(type: Type);
  958. PROCEDURE ^ SetModule*(module: Module);
  959. PROCEDURE ^ SetDirect*(d: BOOLEAN);
  960. PROCEDURE ^ SetModuleName*(moduleName: Identifier);
  961. PROCEDURE ^ SetContext*(context: Identifier);
  962. PROCEDURE ^ Accept*(v: Visitor);
  963. END Import;
  964. StatementSequence* = OBJECT
  965. VAR
  966. list: Basic.List;
  967. PROCEDURE ^ & InitList;
  968. PROCEDURE ^ Length*(): LONGINT;
  969. PROCEDURE ^ AddStatement*(statement: Statement);
  970. PROCEDURE ^ PrependStatement*(statement: Statement);
  971. PROCEDURE ^ HasStatement*(statement: Statement): BOOLEAN;
  972. PROCEDURE ^ GetStatement*(index: LONGINT): Statement;
  973. PROCEDURE ^ SetStatement*(index: LONGINT; statement: Statement);
  974. PROCEDURE ^ RemoveStatement*(statement: Statement);
  975. PROCEDURE ^ InsertBefore*(search, new: Statement);
  976. PROCEDURE ^ Clone(VAR copy: StatementSequence);
  977. END StatementSequence;
  978. Statement* = OBJECT
  979. VAR
  980. outer-: Statement;
  981. position-: Position;
  982. isUnreachable-: BOOLEAN;
  983. comment-: Comment;
  984. PROCEDURE ^ & InitStatement*(position: Position; outer: Statement);
  985. PROCEDURE ^ SetOuter*(o: Statement);
  986. PROCEDURE ^ SetUnreachable*(unreachable: BOOLEAN);
  987. PROCEDURE ^ Accept*(v: Visitor);
  988. PROCEDURE ^ SetComment*(comment: Comment);
  989. PROCEDURE ^ Clone(): Statement;
  990. END Statement;
  991. ProcedureCallStatement* = OBJECT (Statement)
  992. VAR
  993. call-: Designator;
  994. PROCEDURE ^ & InitProcedureCallStatement(position: Position; call: Designator; outer: Statement);
  995. PROCEDURE ^ SetCall*(call: Designator);
  996. PROCEDURE ^ Clone(): Statement;
  997. PROCEDURE ^ Accept*(v: Visitor);
  998. END ProcedureCallStatement;
  999. Assignment* = OBJECT (Statement)
  1000. VAR
  1001. left-: Designator;
  1002. right-: Expression;
  1003. PROCEDURE ^ & InitAssignment*(position: Position; left: Designator; right: Expression; outer: Statement);
  1004. PROCEDURE ^ SetLeft*(left: Designator);
  1005. PROCEDURE ^ SetRight*(right: Expression);
  1006. PROCEDURE ^ Clone(): Statement;
  1007. PROCEDURE ^ Accept*(v: Visitor);
  1008. END Assignment;
  1009. CommunicationStatement* = OBJECT (Statement)
  1010. VAR
  1011. left-: Designator;
  1012. right-: Expression;
  1013. op-: LONGINT;
  1014. PROCEDURE ^ & InitAssignment*(position: Position; op: LONGINT; left: Designator; right: Expression; outer: Statement);
  1015. PROCEDURE ^ SetLeft*(left: Designator);
  1016. PROCEDURE ^ SetRight*(right: Expression);
  1017. PROCEDURE ^ Accept*(v: Visitor);
  1018. END CommunicationStatement;
  1019. IfPart* = OBJECT
  1020. VAR
  1021. condition-: Expression;
  1022. statements-: StatementSequence;
  1023. comment-: Comment;
  1024. PROCEDURE ^ & InitIfPart;
  1025. PROCEDURE ^ SetCondition*(condition: Expression);
  1026. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1027. PROCEDURE ^ SetComment*(comment: Comment);
  1028. PROCEDURE ^ Clone(): IfPart;
  1029. END IfPart;
  1030. IfStatement* = OBJECT (Statement)
  1031. VAR
  1032. ifPart-: IfPart;
  1033. elsifParts: Basic.List;
  1034. elsePart-: StatementSequence;
  1035. PROCEDURE ^ & InitIfStatement(position: Position; outer: Statement);
  1036. PROCEDURE ^ SetElsePart*(elsePart: StatementSequence);
  1037. PROCEDURE ^ AddElsifPart*(elsifPart: IfPart);
  1038. PROCEDURE ^ GetElsifPart*(i: LONGINT): IfPart;
  1039. PROCEDURE ^ ElsifParts*(): LONGINT;
  1040. PROCEDURE ^ Clone(): Statement;
  1041. PROCEDURE ^ Accept*(v: Visitor);
  1042. END IfStatement;
  1043. WithPart* = OBJECT
  1044. VAR
  1045. variable-: Designator;
  1046. type-: Type;
  1047. statements-: StatementSequence;
  1048. comment-: Comment;
  1049. PROCEDURE ^ & InitWithPart;
  1050. PROCEDURE ^ SetVariable*(variable: Designator);
  1051. PROCEDURE ^ SetType*(type: Type);
  1052. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1053. PROCEDURE ^ SetComment*(comment: Comment);
  1054. PROCEDURE ^ Clone(): WithPart;
  1055. END WithPart;
  1056. WithStatement* = OBJECT (Statement)
  1057. VAR
  1058. withParts-: Basic.List;
  1059. elsePart-: StatementSequence;
  1060. PROCEDURE ^ & InitWithStatement(position: Position; outer: Statement);
  1061. PROCEDURE ^ AddWithPart*(withPart: WithPart);
  1062. PROCEDURE ^ GetWithPart*(i: LONGINT): WithPart;
  1063. PROCEDURE ^ WithParts*(): LONGINT;
  1064. PROCEDURE ^ SetElsePart*(elsePart: StatementSequence);
  1065. PROCEDURE ^ Clone(): Statement;
  1066. PROCEDURE ^ Accept*(v: Visitor);
  1067. END WithStatement;
  1068. CaseConstant* = POINTER TO RECORD
  1069. min*, max*: LONGINT;
  1070. next*: CaseConstant;
  1071. END;
  1072. CasePart* = OBJECT
  1073. VAR
  1074. elements-: ExpressionList;
  1075. firstConstant-: CaseConstant;
  1076. statements-: StatementSequence;
  1077. comment-: Comment;
  1078. PROCEDURE ^ & InitCasePart;
  1079. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1080. PROCEDURE ^ SetConstants*(firstConstant: CaseConstant);
  1081. PROCEDURE ^ SetComment*(comment: Comment);
  1082. PROCEDURE ^ Clone(): CasePart;
  1083. END CasePart;
  1084. CaseStatement* = OBJECT (Statement)
  1085. VAR
  1086. variable-: Expression;
  1087. elsePart-: StatementSequence;
  1088. caseParts-: Basic.List;
  1089. min-, max-: LONGINT;
  1090. PROCEDURE ^ & InitCaseStatement(position: Position; outer: Statement);
  1091. PROCEDURE ^ SetVariable*(expression: Expression);
  1092. PROCEDURE ^ SetElsePart*(elsePart: StatementSequence);
  1093. PROCEDURE ^ AddCasePart*(casePart: CasePart);
  1094. PROCEDURE ^ GetCasePart*(i: LONGINT): CasePart;
  1095. PROCEDURE ^ CaseParts*(): LONGINT;
  1096. PROCEDURE ^ Clone(): Statement;
  1097. PROCEDURE ^ Accept*(v: Visitor);
  1098. PROCEDURE ^ MaxConstant*(): LONGINT;
  1099. PROCEDURE ^ SetMinMax*(min, max: LONGINT);
  1100. END CaseStatement;
  1101. WhileStatement* = OBJECT (Statement)
  1102. VAR
  1103. condition-: Expression;
  1104. statements-: StatementSequence;
  1105. PROCEDURE ^ & InitWhileStatement(position: Position; outer: Statement);
  1106. PROCEDURE ^ SetCondition*(condition: Expression);
  1107. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1108. PROCEDURE ^ Clone(): Statement;
  1109. PROCEDURE ^ Accept*(v: Visitor);
  1110. END WhileStatement;
  1111. RepeatStatement* = OBJECT (Statement)
  1112. VAR
  1113. condition-: Expression;
  1114. statements-: StatementSequence;
  1115. PROCEDURE ^ & InitRepeatStatement(position: Position; outer: Statement);
  1116. PROCEDURE ^ SetCondition*(condition: Expression);
  1117. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1118. PROCEDURE ^ Clone(): Statement;
  1119. PROCEDURE ^ Accept*(v: Visitor);
  1120. END RepeatStatement;
  1121. ForStatement* = OBJECT (Statement)
  1122. VAR
  1123. variable-: Designator;
  1124. from-, to-, by-: Expression;
  1125. statements-: StatementSequence;
  1126. PROCEDURE ^ & InitForStatement(position: Position; outer: Statement);
  1127. PROCEDURE ^ SetVariable*(variable: Designator);
  1128. PROCEDURE ^ SetFrom*(from: Expression);
  1129. PROCEDURE ^ SetTo*(to: Expression);
  1130. PROCEDURE ^ SetBy*(by: Expression);
  1131. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1132. PROCEDURE ^ Clone(): Statement;
  1133. PROCEDURE ^ Accept*(v: Visitor);
  1134. END ForStatement;
  1135. ExitableBlock* = OBJECT (Statement)
  1136. VAR
  1137. statements-: StatementSequence;
  1138. PROCEDURE ^ & InitExitableBlock(position: Position; outer: Statement);
  1139. PROCEDURE ^ SetStatements*(statements: StatementSequence);
  1140. PROCEDURE ^ Clone(): Statement;
  1141. PROCEDURE ^ Accept*(v: Visitor);
  1142. END ExitableBlock;
  1143. LoopStatement* = OBJECT (ExitableBlock)
  1144. PROCEDURE ^ Clone(): Statement;
  1145. PROCEDURE ^ Accept*(v: Visitor);
  1146. END LoopStatement;
  1147. ExitStatement* = OBJECT (Statement)
  1148. PROCEDURE ^ Accept*(v: Visitor);
  1149. PROCEDURE ^ Clone(): Statement;
  1150. END ExitStatement;
  1151. ReturnStatement* = OBJECT (Statement)
  1152. VAR
  1153. returnValue-: Expression;
  1154. PROCEDURE ^ & InitReturnStatement(position: Position; outer: Statement);
  1155. PROCEDURE ^ SetReturnValue*(returnValue: Expression);
  1156. PROCEDURE ^ Clone(): Statement;
  1157. PROCEDURE ^ Accept*(v: Visitor);
  1158. END ReturnStatement;
  1159. AwaitStatement* = OBJECT (Statement)
  1160. VAR
  1161. condition-: Expression;
  1162. PROCEDURE ^ & InitAwaitStatement(position: Position; outer: Statement);
  1163. PROCEDURE ^ SetCondition*(condition: Expression);
  1164. PROCEDURE ^ Clone(): Statement;
  1165. PROCEDURE ^ Accept*(v: Visitor);
  1166. END AwaitStatement;
  1167. Modifier* = OBJECT
  1168. VAR
  1169. identifier-: Identifier;
  1170. expression-: Expression;
  1171. resolved-: BOOLEAN;
  1172. nextModifier-: Modifier;
  1173. position-: Position;
  1174. PROCEDURE ^ & InitModifier(position: Position; identifier: Identifier; expression: Expression);
  1175. PROCEDURE ^ Resolved*;
  1176. PROCEDURE ^ SetExpression*(e: Expression);
  1177. PROCEDURE ^ SetNext*(modifier: Modifier);
  1178. END Modifier;
  1179. StatementBlock* = OBJECT (Statement)
  1180. VAR
  1181. statements-: StatementSequence;
  1182. blockModifiers-: Modifier;
  1183. isExclusive-: BOOLEAN;
  1184. isRealtime-: BOOLEAN;
  1185. isUnchecked-: BOOLEAN;
  1186. isUncooperative-: BOOLEAN;
  1187. PROCEDURE ^ & InitStatementBlock(position: Position; outer: Statement);
  1188. PROCEDURE ^ SetRealtime*(b: BOOLEAN);
  1189. PROCEDURE ^ SetUnchecked*(unchecked: BOOLEAN);
  1190. PROCEDURE ^ SetUncooperative*(uncooperative: BOOLEAN);
  1191. PROCEDURE ^ SetModifier*(modifier: Modifier);
  1192. PROCEDURE ^ SetExclusive*(excl: BOOLEAN);
  1193. PROCEDURE ^ SetStatementSequence*(statements: StatementSequence);
  1194. PROCEDURE ^ Accept*(v: Visitor);
  1195. END StatementBlock;
  1196. Code* = OBJECT (Statement)
  1197. VAR
  1198. sourceCode-: SourceCode;
  1199. sourceCodeLength-: LONGINT;
  1200. inlineCode-: BinaryCode;
  1201. inRules-, outRules-: StatementSequence;
  1202. PROCEDURE ^ & InitCode(position: Position; outer: Statement);
  1203. PROCEDURE ^ SetSourceCode*(source: SourceCode; length: LONGINT);
  1204. PROCEDURE ^ SetBinaryCode*(code: BinaryCode);
  1205. PROCEDURE ^ Clone(): Statement;
  1206. PROCEDURE ^ Accept*(v: Visitor);
  1207. END Code;
  1208. Body* = OBJECT (StatementBlock)
  1209. VAR
  1210. finally-: StatementSequence;
  1211. priority-: Expression;
  1212. inScope-: ProcedureScope;
  1213. code-: Code;
  1214. isActive-, isSafe-: BOOLEAN;
  1215. PROCEDURE ^ & InitBody(position: Position; scope: ProcedureScope);
  1216. PROCEDURE ^ SetActive*(active: BOOLEAN);
  1217. PROCEDURE ^ SetSafe*(safe: BOOLEAN);
  1218. PROCEDURE ^ SetFinally*(finally: StatementSequence);
  1219. PROCEDURE ^ SetPriority*(expression: Expression);
  1220. PROCEDURE ^ SetCode*(code: Code);
  1221. END Body;
  1222. Comment* = OBJECT
  1223. VAR
  1224. position-: Position;
  1225. source-: String;
  1226. scope-: Scope;
  1227. item-: ANY;
  1228. sameLine-: BOOLEAN;
  1229. nextComment-: Comment;
  1230. PROCEDURE ^ & InitComment(pos: Position; scope: Scope; CONST s: ARRAY OF CHAR; length: LONGINT);
  1231. PROCEDURE ^ SetItem*(p: ANY; sameLine: BOOLEAN);
  1232. END Comment;
  1233. Scope* = OBJECT
  1234. VAR
  1235. firstSymbol-: Symbol;
  1236. numberSymbols-: LONGINT;
  1237. firstConstant-, lastConstant-: Constant;
  1238. numberConstants-: LONGINT;
  1239. firstTypeDeclaration-, lastTypeDeclaration-: TypeDeclaration;
  1240. numberTypeDeclarations-: LONGINT;
  1241. firstVariable-, lastVariable-: Variable;
  1242. numberVariables-: LONGINT;
  1243. firstProcedure-, lastProcedure-: Procedure;
  1244. numberProcedures-: LONGINT;
  1245. outerScope-: Scope;
  1246. nextScope-: Scope;
  1247. ownerModule-: Module;
  1248. PROCEDURE ^ & InitScope(outer: Scope);
  1249. PROCEDURE ^ Clear*;
  1250. PROCEDURE ^ EnterSymbol*(symbol: Symbol; VAR duplicate: BOOLEAN);
  1251. PROCEDURE ^ FindSymbol*(identifier: Identifier): Symbol;
  1252. PROCEDURE ^ AddConstant*(c: Constant);
  1253. PROCEDURE ^ FindConstant*(identifier: Identifier): Constant;
  1254. PROCEDURE ^ AddTypeDeclaration*(t: TypeDeclaration);
  1255. PROCEDURE ^ FindTypeDeclaration*(identifier: Identifier): TypeDeclaration;
  1256. PROCEDURE ^ AddVariable*(v: Variable);
  1257. PROCEDURE ^ PushVariable*(v: Variable);
  1258. PROCEDURE ^ FindVariable*(identifier: Identifier): Variable;
  1259. PROCEDURE ^ AddProcedure*(p: Procedure);
  1260. PROCEDURE ^ FindProcedure*(identifier: Identifier): Procedure;
  1261. PROCEDURE ^ FindMethod*(number: LONGINT): Procedure;
  1262. PROCEDURE ^ Level*(): LONGINT;
  1263. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  1264. END Scope;
  1265. ProcedureScope* = OBJECT (Scope)
  1266. VAR
  1267. ownerProcedure-: Procedure;
  1268. body-: Body;
  1269. PROCEDURE ^ & InitProcedureScope(outer: Scope);
  1270. PROCEDURE ^ SetBody*(body: Body);
  1271. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  1272. END ProcedureScope;
  1273. EnumerationScope* = OBJECT (Scope)
  1274. VAR
  1275. ownerEnumeration-: EnumerationType;
  1276. PROCEDURE ^ FindSymbol*(identifier: Identifier): Symbol;
  1277. PROCEDURE ^ & InitEnumerationScope(outer: Scope);
  1278. END EnumerationScope;
  1279. RecordScope* = OBJECT (Scope)
  1280. VAR
  1281. ownerRecord-: RecordType;
  1282. bodyProcedure-: Procedure;
  1283. constructor-: Procedure;
  1284. finalizer-: Procedure;
  1285. numberMethods-: LONGINT;
  1286. firstParameter-, lastParameter-: Parameter;
  1287. numberParameters-: LONGINT;
  1288. firstOperator-, lastOperator-: Operator;
  1289. numberOperators: LONGINT;
  1290. PROCEDURE ^ & InitRecordScope(outer: Scope);
  1291. PROCEDURE ^ SetBodyProcedure*(body: Procedure);
  1292. PROCEDURE ^ SetConstructor*(body: Procedure);
  1293. PROCEDURE ^ SetFinalizer*(body: Procedure);
  1294. PROCEDURE ^ SetNumberMethods*(numberMethods: LONGINT);
  1295. PROCEDURE ^ AddOperator*(p: Operator);
  1296. PROCEDURE ^ FindSymbol*(identifier: Identifier): Symbol;
  1297. PROCEDURE ^ FindConstant*(identifier: Identifier): Constant;
  1298. PROCEDURE ^ FindTypeDeclaration*(identifier: Identifier): TypeDeclaration;
  1299. PROCEDURE ^ FindVariable*(identifier: Identifier): Variable;
  1300. PROCEDURE ^ FindProcedure*(identifier: Identifier): Procedure;
  1301. PROCEDURE ^ FindMethod*(number: LONGINT): Procedure;
  1302. PROCEDURE ^ NeedsTrace*(): BOOLEAN;
  1303. END RecordScope;
  1304. CellScope* = OBJECT (Scope)
  1305. VAR
  1306. ownerCell-: CellType;
  1307. bodyProcedure-: Procedure;
  1308. constructor-: Procedure;
  1309. firstImport-, lastImport-: Import;
  1310. numberImports: LONGINT;
  1311. PROCEDURE ^ & InitCellScope(outer: Scope);
  1312. PROCEDURE ^ Clear*;
  1313. PROCEDURE ^ SetOwnerCell*(owner: CellType);
  1314. PROCEDURE ^ SetBodyProcedure*(bodyProcedure: Procedure);
  1315. PROCEDURE ^ SetConstructor*(p: Procedure);
  1316. PROCEDURE ^ AddImport*(i: Import);
  1317. PROCEDURE ^ FindImport*(identifier: Identifier): Import;
  1318. PROCEDURE ^ GetImport*(index: LONGINT): Import;
  1319. PROCEDURE ^ FindSymbol*(identifier: Identifier): Symbol;
  1320. END CellScope;
  1321. ModuleScope* = OBJECT (Scope)
  1322. VAR
  1323. firstImport-, lastImport-: Import;
  1324. numberImports: LONGINT;
  1325. firstOperator-, lastOperator-: Operator;
  1326. numberOperators: LONGINT;
  1327. firstBuiltin-, lastBuiltin-: Builtin;
  1328. numberBuiltins: LONGINT;
  1329. firstComment-, lastComment-: Comment;
  1330. numberComments-: LONGINT;
  1331. bodyProcedure-: Procedure;
  1332. PROCEDURE ^ & InitModuleScope;
  1333. PROCEDURE ^ SetBodyProcedure*(body: Procedure);
  1334. PROCEDURE ^ SetGlobalScope*(outer: Scope);
  1335. PROCEDURE ^ AddBuiltin*(p: Builtin);
  1336. PROCEDURE ^ AddOperator*(p: Operator);
  1337. PROCEDURE ^ FindOperator*(identifier: Identifier): Operator;
  1338. PROCEDURE ^ AddImport*(i: Import);
  1339. PROCEDURE ^ FindImport*(identifier: Identifier): Import;
  1340. PROCEDURE ^ GetImport*(index: LONGINT): Import;
  1341. PROCEDURE ^ AddComment*(comment: Comment);
  1342. PROCEDURE ^ ImportByModuleName*(moduleName, context: Identifier): Import;
  1343. PROCEDURE ^ RemoveImporters*(moduleName, context: Identifier);
  1344. END ModuleScope;
  1345. Module* = OBJECT (Symbol)
  1346. VAR
  1347. sourceName-: Basic.FileName;
  1348. moduleScope-: ModuleScope;
  1349. context-: Identifier;
  1350. case-: LONGINT;
  1351. isCellNet-: BOOLEAN;
  1352. firstScope-, lastScope-: Scope;
  1353. numberScopes-: LONGINT;
  1354. closingComment-: Comment;
  1355. modifiers-: Modifier;
  1356. PROCEDURE ^ & InitModule(CONST sourceName: ARRAY OF CHAR; position: Position; name: Identifier; scope: ModuleScope; case: LONGINT);
  1357. PROCEDURE ^ SetCase*(case: LONGINT);
  1358. PROCEDURE ^ SetCellNet*(isCellNet: BOOLEAN);
  1359. PROCEDURE ^ SetContext*(context: Identifier);
  1360. PROCEDURE ^ SetName*(name: Identifier);
  1361. PROCEDURE ^ SetClosingComment*(comment: Comment);
  1362. PROCEDURE ^ SetModifiers*(modifiers: Modifier);
  1363. PROCEDURE ^ AddScope*(c: Scope);
  1364. PROCEDURE ^ Accept*(v: Visitor);
  1365. END Module;
  1366. SymbolList* = OBJECT
  1367. VAR
  1368. list: Basic.List;
  1369. PROCEDURE ^ & InitList*;
  1370. PROCEDURE ^ Length*(): LONGINT;
  1371. PROCEDURE ^ AddSymbol*(d: Symbol);
  1372. PROCEDURE ^ GetSymbol*(index: LONGINT): Symbol;
  1373. PROCEDURE ^ SetSymbol*(index: LONGINT; expression: Symbol);
  1374. PROCEDURE ^ RemoveSymbol*(i: LONGINT);
  1375. END SymbolList;
  1376. VAR
  1377. invalidIdentifier-: Identifier;
  1378. invalidQualifiedIdentifier-: QualifiedIdentifier;
  1379. invalidType-: Type;
  1380. invalidExpression-: Expression;
  1381. invalidDesignator-: Designator;
  1382. invalidValue-: Value;
  1383. invalidSymbol-: Symbol;
  1384. invalidPosition-: Position;
  1385. anonymousIdentifier-: Identifier;
  1386. importType-: Type;
  1387. typeDeclarationType-: Type;
  1388. moduleType-: Type;
  1389. indexListSeparator-: Expression;
  1390. PROCEDURE ^ InitFingerPrint*(VAR fingerprint: FingerPrint);
  1391. PROCEDURE ^ NewModule*(CONST sourceName: ARRAY OF CHAR; position: Position; name: Identifier; scope: ModuleScope; case: LONGINT): Module;
  1392. PROCEDURE ^ NewComment*(position: Position; scope: Scope; CONST source: ARRAY OF CHAR; length: LONGINT): Comment;
  1393. PROCEDURE ^ NewImport*(position: Position; alias, name: Identifier; direct: BOOLEAN): Import;
  1394. PROCEDURE ^ NewConstant*(position: Position; name: Identifier): Constant;
  1395. PROCEDURE ^ NewProcedure*(position: Position; name: Identifier; scope: ProcedureScope): Procedure;
  1396. PROCEDURE ^ NewBuiltin*(position: Position; name: Identifier; id: LONGINT): Builtin;
  1397. PROCEDURE ^ NewCustomBuiltin*(position: Position; name: Identifier; id: LONGINT; subType: SHORTINT): CustomBuiltin;
  1398. PROCEDURE ^ NewOperator*(position: Position; name: Identifier; scope: ProcedureScope): Operator;
  1399. PROCEDURE ^ NewType*(): Type;
  1400. PROCEDURE ^ NewByteType*(sizeInBits: LONGINT): ByteType;
  1401. PROCEDURE ^ NewAnyType*(sizeInBits: LONGINT): AnyType;
  1402. PROCEDURE ^ NewObjectType*(sizeInBits: LONGINT): ObjectType;
  1403. PROCEDURE ^ NewNilType*(sizeInBits: LONGINT): NilType;
  1404. PROCEDURE ^ NewAddressType*(sizeInBits: LONGINT): AddressType;
  1405. PROCEDURE ^ NewSizeType*(sizeInBits: LONGINT): SizeType;
  1406. PROCEDURE ^ NewBooleanType*(sizeInBits: LONGINT): BooleanType;
  1407. PROCEDURE ^ NewSetType*(sizeInBits: LONGINT): SetType;
  1408. PROCEDURE ^ NewCharacterType*(sizeInBits: LONGINT): CharacterType;
  1409. PROCEDURE ^ NewRangeType*(sizeInBits: LONGINT): RangeType;
  1410. PROCEDURE ^ NewComplexType*(base: Type): ComplexType;
  1411. PROCEDURE ^ NewIntegerType*(size: LONGINT; signed: BOOLEAN): IntegerType;
  1412. PROCEDURE ^ NewFloatType*(sizeInBits: LONGINT): FloatType;
  1413. PROCEDURE ^ NewTypeDeclaration*(position: Position; name: Identifier): TypeDeclaration;
  1414. PROCEDURE ^ NewStringType*(position: Position; baseType: Type; length: LONGINT): StringType;
  1415. PROCEDURE ^ NewEnumerationType*(position: Position; scope: Scope; enumerationScope: EnumerationScope): EnumerationType;
  1416. PROCEDURE ^ NewArrayType*(position: Position; scope: Scope; form: LONGINT): ArrayType;
  1417. PROCEDURE ^ NewMathArrayType*(position: Position; scope: Scope; form: LONGINT): MathArrayType;
  1418. PROCEDURE ^ NewPointerType*(position: Position; scope: Scope): PointerType;
  1419. PROCEDURE ^ NewPortType*(position: Position; direction: LONGINT; sizeExpression: Expression; scope: Scope): PortType;
  1420. PROCEDURE ^ NewRecordType*(position: Position; scope: Scope; recordScope: RecordScope): RecordType;
  1421. PROCEDURE ^ NewCellType*(position: Position; scope: Scope; cellScope: CellScope): CellType;
  1422. PROCEDURE ^ NewProcedureType*(position: Position; scope: Scope): ProcedureType;
  1423. PROCEDURE ^ NewQualifiedType*(position: Position; scope: Scope; qualifiedIdentifier: QualifiedIdentifier): QualifiedType;
  1424. PROCEDURE ^ NewSymbol*(name: Identifier): Symbol;
  1425. PROCEDURE ^ NewVariable*(position: Position; name: Identifier): Variable;
  1426. PROCEDURE ^ NewQualifiedIdentifier*(position: Position; prefix, suffix: Identifier): QualifiedIdentifier;
  1427. PROCEDURE ^ NewIdentifier*(CONST name: ARRAY OF CHAR): Identifier;
  1428. PROCEDURE ^ NewParameter*(position: Position; ownerType: Type; name: Identifier; passAs: LONGINT): Parameter;
  1429. PROCEDURE ^ NewProperty*(position: Position; name: Identifier): Property;
  1430. PROCEDURE ^ NewExpressionList*(): ExpressionList;
  1431. PROCEDURE ^ CloneExpressionList*(l: ExpressionList): ExpressionList;
  1432. PROCEDURE ^ NewDesignator*(): Designator;
  1433. PROCEDURE ^ NewIdentifierDesignator*(position: Position; identifier: Identifier): IdentifierDesignator;
  1434. PROCEDURE ^ NewSelectorDesignator*(position: Position; left: Designator; name: Identifier): SelectorDesignator;
  1435. PROCEDURE ^ NewParameterDesignator*(position: Position; left: Designator; expressionList: ExpressionList): ParameterDesignator;
  1436. PROCEDURE ^ NewArrowDesignator*(position: Position; left: Designator): ArrowDesignator;
  1437. PROCEDURE ^ NewBracketDesignator*(position: Position; left: Designator; expressionList: ExpressionList): BracketDesignator;
  1438. PROCEDURE ^ NewSymbolDesignator*(position: Position; left: Designator; symbol: Symbol): SymbolDesignator;
  1439. PROCEDURE ^ NewIndexDesignator*(position: Position; left: Designator): IndexDesignator;
  1440. PROCEDURE ^ NewProcedureCallDesignator*(position: Position; left: Designator; parameters: ExpressionList): ProcedureCallDesignator;
  1441. PROCEDURE ^ NewBuiltinCallDesignator*(position: Position; id: LONGINT; left: Designator; parameters: ExpressionList): BuiltinCallDesignator;
  1442. PROCEDURE ^ NewTypeGuardDesignator*(position: Position; left: Designator; type: Type): TypeGuardDesignator;
  1443. PROCEDURE ^ NewDereferenceDesignator*(position: Position; left: Designator): DereferenceDesignator;
  1444. PROCEDURE ^ NewSupercallDesignator*(position: Position; left: Designator): SupercallDesignator;
  1445. PROCEDURE ^ NewSelfDesignator*(position: Position): SelfDesignator;
  1446. PROCEDURE ^ NewResultDesignator*(position: Position): ResultDesignator;
  1447. PROCEDURE ^ NewExpression*(): Expression;
  1448. PROCEDURE ^ CloneExpression*(e: Expression): Expression;
  1449. PROCEDURE ^ CloneDesignator*(e: Expression): Designator;
  1450. PROCEDURE ^ NewElement*(position: Position; from, to: Expression): Expression;
  1451. PROCEDURE ^ NewSet*(position: Position): Set;
  1452. PROCEDURE ^ NewMathArrayExpression*(position: Position): MathArrayExpression;
  1453. PROCEDURE ^ NewBinaryExpression*(position: Position; left, right: Expression; operator: LONGINT): BinaryExpression;
  1454. PROCEDURE ^ NewRangeExpression*(position: Position; first, last, step: Expression): RangeExpression;
  1455. PROCEDURE ^ NewTensorRangeExpression*(position: Position): TensorRangeExpression;
  1456. PROCEDURE ^ NewUnaryExpression*(position: Position; operand: Expression; operator: LONGINT): UnaryExpression;
  1457. PROCEDURE ^ NewConversion*(position: Position; expression: Expression; type: Type; typeExpression: Expression): Conversion;
  1458. PROCEDURE ^ NewValue*(): Value;
  1459. PROCEDURE ^ NewIntegerValue*(position: Position; value: HUGEINT): IntegerValue;
  1460. PROCEDURE ^ NewCharacterValue*(position: Position; value: CHAR): CharacterValue;
  1461. PROCEDURE ^ NewSetValue*(position: Position; value: SET): SetValue;
  1462. PROCEDURE ^ NewMathArrayValue*(position: Position): MathArrayValue;
  1463. PROCEDURE ^ NewRealValue*(position: Position; value: LONGREAL): RealValue;
  1464. PROCEDURE ^ NewComplexValue*(position: Position; realValue, imagValue: LONGREAL): ComplexValue;
  1465. PROCEDURE ^ NewStringValue*(position: Position; value: String): StringValue;
  1466. PROCEDURE ^ NewBooleanValue*(position: Position; value: BOOLEAN): BooleanValue;
  1467. PROCEDURE ^ NewNilValue*(position: Position): NilValue;
  1468. PROCEDURE ^ NewEnumerationValue*(position: Position; value: LONGINT): EnumerationValue;
  1469. PROCEDURE ^ NewStatement*(outer: Statement): Statement;
  1470. PROCEDURE ^ CloneStatement*(statement: Statement): Statement;
  1471. PROCEDURE ^ NewStatementSequence*(): StatementSequence;
  1472. PROCEDURE ^ CloneStatementSequence*(statementSequence: StatementSequence): StatementSequence;
  1473. PROCEDURE ^ NewModifier*(position: Position; identifier: Identifier; expression: Expression): Modifier;
  1474. PROCEDURE ^ NewStatementBlock*(position: Position; outer: Statement): StatementBlock;
  1475. PROCEDURE ^ NewStatementDesignator*(position: Position; s: Statement): StatementDesignator;
  1476. PROCEDURE ^ NewBody*(position: Position; scope: ProcedureScope): Body;
  1477. PROCEDURE ^ NewIfPart*(): IfPart;
  1478. PROCEDURE ^ NewIfStatement*(position: Position; outer: Statement): IfStatement;
  1479. PROCEDURE ^ NewAssignment*(position: Position; left: Designator; right: Expression; outer: Statement): Assignment;
  1480. PROCEDURE ^ NewCommunicationStatement*(position: Position; op: LONGINT; left: Designator; right: Expression; outer: Statement): CommunicationStatement;
  1481. PROCEDURE ^ NewProcedureCallStatement*(position: Position; call: Designator; outer: Statement): ProcedureCallStatement;
  1482. PROCEDURE ^ NewCaseStatement*(position: Position; outer: Statement): CaseStatement;
  1483. PROCEDURE ^ NewCasePart*(): CasePart;
  1484. PROCEDURE ^ NewWithPart*(): WithPart;
  1485. PROCEDURE ^ NewWithStatement*(position: Position; outer: Statement): WithStatement;
  1486. PROCEDURE ^ NewWhileStatement*(position: Position; outer: Statement): WhileStatement;
  1487. PROCEDURE ^ NewRepeatStatement*(position: Position; outer: Statement): RepeatStatement;
  1488. PROCEDURE ^ NewForStatement*(position: Position; outer: Statement): ForStatement;
  1489. PROCEDURE ^ NewLoopStatement*(position: Position; outer: Statement): LoopStatement;
  1490. PROCEDURE ^ NewExitableBlock*(position: Position; outer: Statement): ExitableBlock;
  1491. PROCEDURE ^ NewExitStatement*(position: Position; outer: Statement): ExitStatement;
  1492. PROCEDURE ^ NewReturnStatement*(position: Position; outer: Statement): ReturnStatement;
  1493. PROCEDURE ^ NewAwaitStatement*(position: Position; outer: Statement): AwaitStatement;
  1494. PROCEDURE ^ NewCode*(position: Position; outer: Statement): Code;
  1495. PROCEDURE ^ NewProcedureScope*(outer: Scope): ProcedureScope;
  1496. PROCEDURE ^ NewModuleScope*(): ModuleScope;
  1497. PROCEDURE ^ NewRecordScope*(outer: Scope): RecordScope;
  1498. PROCEDURE ^ NewCellScope*(outer: Scope): CellScope;
  1499. PROCEDURE ^ NewEnumerationScope*(outer: Scope): EnumerationScope;
  1500. PROCEDURE ^ Init;
  1501. BEGIN
  1502. END FoxSyntaxTree.