SmaCC Transformation Toolkit properties

Scripts can define properties that can be accessed through getter and setter methods that are automatically created. As an example, consider the method from theSmaCC Transformation Toolkit methods page, it used temporaryVariables and functions that properties are defined by a property rule:

Properties can be local or global. Local properties are initialized to nil for each file that is transformed. Global properties retain their value across files that are transformed. Globals are useful for lengthy computations of values that are used for every file processed. For example, you may load some external file that control the rules. You don't want to load the file for every source file processed as there may be thousands of source files. Instead you can initialize the global property once using the SmaCCRewriteMatchContext>>#initializeGlobalProperty:withValueFrom: initializeGlobalProperty: aSymbol withValueFrom: aBlock (self class classPool at: aSymbol ifAbsent: [ nil ]) == SmaCCRewriteMatchContext uninitializedValue ifTrue: [ self class classPool at: aSymbol put: aBlock value ] method and access its value when processing other files. To initialize the properties before other rules are applied, it is common to create a rewrite rule that matches the top level node in the AST, and for the rewrite transformation, it performs all of the initialization necessary, and then calls self continue. To match the top level AST node, you can either match the node type that you know the parser returns, or you can match SmaCCParseNode Object << #SmaCCParseNode slots: { #parent . #attributes }; package: 'SmaCC_Runtime' and a matching expression of match parent isNil.