!TranslatorGenerator methodsFor: 'testing'! buildAndInstallParserNamed: name tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock self tokenSpecification: tSpec. self grammarSpecification: gSpec. self buildParserIfFail: failBlock. self parser fastParser createScannerParserClassesNamed: name category: self testingCategoryName tokenSpec: self tokenSpecification grammarSpec: self grammarSpecification! grammarSpec: gSpec targetGrammar: gram ifFail: failBlock self grammarSpecification: gSpec. self buildParserIfFail: failBlock. self grammar printString = gram ifTrue: [Transcript show: '*'] ifFalse: failBlock.! parseInputs: strings compareDTTo: dtTargets compareSASTTo: sastTargets tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock | scannerName parserName dt | scannerName := (self testingClassBaseName , 'Scanner') asSymbol. parserName := (self testingClassBaseName , 'Parser') asSymbol. (Smalltalk includesKey: scannerName) ifTrue: [self error: 'A class named ' , scannerName , ' already exists.']. (Smalltalk includesKey: parserName) ifTrue: [self error: 'A class named ' , parserName , ' already exists.']. self buildAndInstallParserNamed: self testingClassBaseName tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock. strings with: dtTargets do: [:string :target | dt := (Smalltalk at: parserName) new parseForDerivationTree: string ifFail: failBlock. dt printString = target ifTrue: [Transcript show: '*'] ifFalse: failBlock]. strings with: sastTargets do: [:string :target | dt := (Smalltalk at: parserName) new parseForShamAST: string ifFail: failBlock. dt printString = target ifTrue: [Transcript show: '*'] ifFalse: failBlock]. (Smalltalk includesKey: scannerName) ifTrue: [(Smalltalk at: scannerName) removeFromSystem]. (Smalltalk includesKey: parserName) ifTrue: [(Smalltalk at: parserName) removeFromSystem]! parseInputs: strings compareDTTo: targets tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock | scannerName parserName dt | scannerName := (self testingClassBaseName , 'Scanner') asSymbol. parserName := (self testingClassBaseName , 'Parser') asSymbol. (Smalltalk includesKey: scannerName) ifTrue: [self error: 'A class named ' , scannerName , ' already exists.']. (Smalltalk includesKey: parserName) ifTrue: [self error: 'A class named ' , parserName , ' already exists.']. self buildAndInstallParserNamed: self testingClassBaseName tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock. strings with: targets do: [:string :target | dt := (Smalltalk at: parserName) new parseForDerivationTree: string ifFail: failBlock. dt printString = target ifTrue: [Transcript show: '*'] ifFalse: failBlock]. (Smalltalk includesKey: scannerName) ifTrue: [(Smalltalk at: scannerName) removeFromSystem]. (Smalltalk includesKey: parserName) ifTrue: [(Smalltalk at: parserName) removeFromSystem]! parseInputs: strings compareDTToAny: targets tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock "The argument 'strings' is an Array of strings. The argument 'targets' is an Array of Array of strings. The test for a given element of 'strings' will succeed if it matches any of the strings in the corresponding 'targets' Array. Due to the nondeterminism of hashing, productions are sometimes processed in different orders and new nonterminals get numbered differently. As an example, see TranslatorGenerator class>>basicLLParserGenerationTest2." | scannerName parserName dt dtps | scannerName := (self testingClassBaseName , 'Scanner') asSymbol. parserName := (self testingClassBaseName , 'Parser') asSymbol. (Smalltalk includesKey: scannerName) ifTrue: [self error: 'A class named ' , scannerName , ' already exists.']. (Smalltalk includesKey: parserName) ifTrue: [self error: 'A class named ' , parserName , ' already exists.']. self buildAndInstallParserNamed: self testingClassBaseName tokenSpec: tSpec grammarSpec: gSpec ifFail: failBlock. strings with: targets do: [:string :target | dt := (Smalltalk at: parserName) new parseForDerivationTree: string ifFail: failBlock. dtps := dt printString. (target inject: false into: [:result :targetStr | result or: [dtps = targetStr]]) ifTrue: [Transcript show: '*'] ifFalse: failBlock]. (Smalltalk includesKey: scannerName) ifTrue: [(Smalltalk at: scannerName) removeFromSystem]. (Smalltalk includesKey: parserName) ifTrue: [(Smalltalk at: parserName) removeFromSystem]! testingCategoryName ^'T-gen-Interface'! testingClassBaseName ^'TgenTemporaryTest'! ! !TranslatorGenerator class methodsFor: 'testing'! basicLLParserGenerationTest1 "TranslatorGenerator basicLLParserGenerationTest1" | tgen failBlock testName | testName := 'T-gen LL Parser Generation Test 1'. tgen := self new setGrammarModeToLL. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( '' 'aabb' ) compareDTTo: (Array with: '#S\ . ''''\' withCRs with: '#S\ . ''a''\ . #S\ . . ''a''\ . . #S\ . . . ''''\ . . ''b''\ . ''b''\' withCRs ) compareSASTTo: (Array with: '#Core\' withCRs with: '#Pair\ . #Pair\ . . #Core\' withCRs ) tokenSpec: '' grammarSpec: ' S : ''a'' S ''b'' {Pair} ; S : {Core} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLLParserGenerationTest2 "TranslatorGenerator basicLLParserGenerationTest2" | tgen failBlock testName | testName := 'T-gen LL Parser Generation Test 2'. tgen := self new setGrammarModeToLL. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: (Array with: ' program\ var a b c : integer\ begin\ a := 3;\ b := a * 4 * 5;\ begin\ c := a + b * 19;\ b := b * c + 1;\ a := (a + 1) * a;\ end\ c := b * (c + 5);\ end\' withCRs ) compareDTToAny: (Array with: (Array with: '#Z\ . ''program''\ . #Decls\ . . ''var''\ . . #IdList\ . . . #Name\ . . . . ''''\ . . . #IdList1\ . . . . #IdList\ . . . . . #Name\ . . . . . . ''''\ . . . . . #IdList1\ . . . . . . #IdList\ . . . . . . . #Name\ . . . . . . . . ''''\ . . . . . . . #IdList1\ . . . . . . . . ''''\ . . '':''\ . . ''integer''\ . #Stmts\ . . ''begin''\ . . #SL\ . . . #S\ . . . . #Name\ . . . . . ''''\ . . . . '':=''\ . . . . #E\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''''\ . . . . . . #T1\ . . . . . . . ''''\ . . . . . #E0\ . . . . . . ''''\ . . . . '';''\ . . . #SL2\ . . . . #SL\ . . . . . #S\ . . . . . . #Name\ . . . . . . . ''''\ . . . . . . '':=''\ . . . . . . #E\ . . . . . . . #T\ . . . . . . . . #P\ . . . . . . . . . #Name\ . . . . . . . . . . ''''\ . . . . . . . . #T1\ . . . . . . . . . ''*''\ . . . . . . . . . #T\ . . . . . . . . . . #P\ . . . . . . . . . . . ''''\ . . . . . . . . . . #T1\ . . . . . . . . . . . ''*''\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''''\ . . . . . . . #E0\ . . . . . . . . ''''\ . . . . . . '';''\ . . . . . #SL2\ . . . . . . #SL\ . . . . . . . #Stmts\ . . . . . . . . ''begin''\ . . . . . . . . #SL\ . . . . . . . . . #S\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . . '':=''\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . #E0\ . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . #T\ . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . '';''\ . . . . . . . . . #SL2\ . . . . . . . . . . #SL\ . . . . . . . . . . . #S\ . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . '':=''\ . . . . . . . . . . . . #E\ . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . '';''\ . . . . . . . . . . . #SL2\ . . . . . . . . . . . . #SL\ . . . . . . . . . . . . . #S\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . '':=''\ . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . ''(''\ . . . . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . '')''\ . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . '';''\ . . . . . . . . . . . . . #SL2\ . . . . . . . . . . . . . . ''''\ . . . . . . . . ''end''\ . . . . . . . #SL1\ . . . . . . . . #SL\ . . . . . . . . . #S\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . . '':=''\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . ''(''\ . . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . '')''\ . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . #E0\ . . . . . . . . . . . . ''''\ . . . . . . . . . . '';''\ . . . . . . . . . #SL2\ . . . . . . . . . . ''''\ . . ''end''\' withCRs with: '#Z\ . ''program''\ . #Decls\ . . ''var''\ . . #IdList\ . . . #Name\ . . . . ''''\ . . . #IdList1\ . . . . #IdList\ . . . . . #Name\ . . . . . . ''''\ . . . . . #IdList1\ . . . . . . #IdList\ . . . . . . . #Name\ . . . . . . . . ''''\ . . . . . . . #IdList1\ . . . . . . . . ''''\ . . '':''\ . . ''integer''\ . #Stmts\ . . ''begin''\ . . #SL\ . . . #S\ . . . . #Name\ . . . . . ''''\ . . . . '':=''\ . . . . #E\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''''\ . . . . . . #T1\ . . . . . . . ''''\ . . . . . #E0\ . . . . . . ''''\ . . . . '';''\ . . . #SL1\ . . . . #SL\ . . . . . #S\ . . . . . . #Name\ . . . . . . . ''''\ . . . . . . '':=''\ . . . . . . #E\ . . . . . . . #T\ . . . . . . . . #P\ . . . . . . . . . #Name\ . . . . . . . . . . ''''\ . . . . . . . . #T1\ . . . . . . . . . ''*''\ . . . . . . . . . #T\ . . . . . . . . . . #P\ . . . . . . . . . . . ''''\ . . . . . . . . . . #T1\ . . . . . . . . . . . ''*''\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''''\ . . . . . . . #E0\ . . . . . . . . ''''\ . . . . . . '';''\ . . . . . #SL1\ . . . . . . #SL\ . . . . . . . #Stmts\ . . . . . . . . ''begin''\ . . . . . . . . #SL\ . . . . . . . . . #S\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . . '':=''\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . #E0\ . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . #T\ . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . '';''\ . . . . . . . . . #SL1\ . . . . . . . . . . #SL\ . . . . . . . . . . . #S\ . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . '':=''\ . . . . . . . . . . . . #E\ . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . '';''\ . . . . . . . . . . . #SL1\ . . . . . . . . . . . . #SL\ . . . . . . . . . . . . . #S\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . '':=''\ . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . ''(''\ . . . . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . '')''\ . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . '';''\ . . . . . . . . . . . . . #SL1\ . . . . . . . . . . . . . . ''''\ . . . . . . . . ''end''\ . . . . . . . #SL2\ . . . . . . . . #SL\ . . . . . . . . . #S\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . . '':=''\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . ''(''\ . . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . . . #E0\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . . '')''\ . . . . . . . . . . . . . . #T1\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . #E0\ . . . . . . . . . . . . ''''\ . . . . . . . . . . '';''\ . . . . . . . . . #SL1\ . . . . . . . . . . ''''\ . . ''end''\' withCRs )) tokenSpec: ' : [a-z]+ ; : [0-9]+ ; : [\s\t\r]+ {ignoreDelimiter} ; ' grammarSpec: ' Z : ''program'' Decls Stmts {Program} ; Decls : ''var'' IdList '':'' ''integer'' {Decls} ; IdList : Name IdList {liftRightChild} ; IdList : Name {IdList} ; Stmts : ''begin'' SL ''end'' {Stmts} ; SL : S SL {liftRightChild} ; SL : Stmts SL {liftRightChild} ; SL : S {StmtList} ; SL : Stmts {StmtList} ; S : Name '':='' E '';'' {Assign} ; E : E ''+'' T {Plus} ; E : T ; T : P ''*'' T {Times} ; T : P; P : ''('' E '')'' ; P : Name ; P : {Number} ; Name : {Id} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLLParserGenerationTest3 "TranslatorGenerator basicLLParserGenerationTest3" | tgen failBlock testName | testName := 'T-gen LL Parser Generation Test 3'. tgen := self new setGrammarModeToLL. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( 'a' 'a + b * c + a' ) compareDTTo: (Array with: '#E\ . #T\ . . #P\ . . . ''a''\ . . #Tc\ . . . ''''\ . #Ec\ . . ''''\' withCRs with: '#E\ . #T\ . . #P\ . . . ''a''\ . . #Tc\ . . . ''''\ . #Ec\ . . ''+''\ . . #E\ . . . #T\ . . . . #P\ . . . . . ''b''\ . . . . #Tc\ . . . . . ''*''\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''c''\ . . . . . . #Tc\ . . . . . . . ''''\ . . . #Ec\ . . . . ''+''\ . . . . #E\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''a''\ . . . . . . #Tc\ . . . . . . . ''''\ . . . . . #Ec\ . . . . . . ''''\' withCRs ) compareSASTTo: (Array with: '#A\' withCRs with: '#Plus\ . #A\ . #Plus\ . . #Times\ . . . #B\ . . . #C\ . . #A\' withCRs ) tokenSpec: ' : [\s\t\r]+ {ignoreDelimiter} ; ' grammarSpec: ' E : T Ec {liftRightChild} ; Ec : ''+'' E {Plus} ; Ec : {nil} ; T : P Tc {liftRightChild} ; Tc : ''*'' T {Times} ; Tc : {nil} ; P : ''a'' {A} ; P : ''b'' {B} ; P : ''c'' {C} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest1 "TranslatorGenerator basicLRParserGenerationTest1" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 1'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( '' 'aabb' ) compareDTTo: (Array with: '#S\ . ''''\' withCRs with: '#S\ . ''a''\ . #S\ . . ''a''\ . . #S\ . . . ''''\ . . ''b''\ . ''b''\' withCRs ) compareSASTTo: (Array with: '#Core\' withCRs with: '#Pair\ . #Pair\ . . #Core\' withCRs ) tokenSpec: '' grammarSpec: ' S : ''a'' S ''b'' {Pair} ; S : {Core} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest2 "TranslatorGenerator basicLRParserGenerationTest2" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 2'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: (Array with: ' program\ var a b c : integer\ begin\ a := 3;\ b := a * 4 * 5;\ begin\ c := a + b * 19;\ b := b * c + 1;\ a := (a + 1) * a;\ end\ c := b * (c + 5);\ end\' withCRs ) compareDTTo: (Array with: '#Z\ . ''program''\ . #Decls\ . . ''var''\ . . #IdList\ . . . #Name\ . . . . ''''\ . . . #IdList\ . . . . #Name\ . . . . . ''''\ . . . . #IdList\ . . . . . #Name\ . . . . . . ''''\ . . '':''\ . . ''integer''\ . #Stmts\ . . ''begin''\ . . #SL\ . . . #S\ . . . . #Name\ . . . . . ''''\ . . . . '':=''\ . . . . #E\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''''\ . . . . '';''\ . . . #SL\ . . . . #S\ . . . . . #Name\ . . . . . . ''''\ . . . . . '':=''\ . . . . . #E\ . . . . . . #T\ . . . . . . . #P\ . . . . . . . . #Name\ . . . . . . . . . ''''\ . . . . . . . ''*''\ . . . . . . . #T\ . . . . . . . . #P\ . . . . . . . . . ''''\ . . . . . . . . ''*''\ . . . . . . . . #T\ . . . . . . . . . #P\ . . . . . . . . . . ''''\ . . . . . '';''\ . . . . #SL\ . . . . . #Stmts\ . . . . . . ''begin''\ . . . . . . #SL\ . . . . . . . #S\ . . . . . . . . #Name\ . . . . . . . . . ''''\ . . . . . . . . '':=''\ . . . . . . . . #E\ . . . . . . . . . #E\ . . . . . . . . . . #T\ . . . . . . . . . . . #P\ . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . ''''\ . . . . . . . . . ''+''\ . . . . . . . . . #T\ . . . . . . . . . . #P\ . . . . . . . . . . . #Name\ . . . . . . . . . . . . ''''\ . . . . . . . . . . ''*''\ . . . . . . . . . . #T\ . . . . . . . . . . . #P\ . . . . . . . . . . . . ''''\ . . . . . . . . '';''\ . . . . . . . #SL\ . . . . . . . . #S\ . . . . . . . . . #Name\ . . . . . . . . . . ''''\ . . . . . . . . . '':=''\ . . . . . . . . . #E\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . #T\ . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . ''+''\ . . . . . . . . . . #T\ . . . . . . . . . . . #P\ . . . . . . . . . . . . ''''\ . . . . . . . . . '';''\ . . . . . . . . #SL\ . . . . . . . . . #S\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . . '':=''\ . . . . . . . . . . #E\ . . . . . . . . . . . #T\ . . . . . . . . . . . . #P\ . . . . . . . . . . . . . ''(''\ . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . #E\ . . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . . '')''\ . . . . . . . . . . . . ''*''\ . . . . . . . . . . . . #T\ . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . '';''\ . . . . . . ''end''\ . . . . . #SL\ . . . . . . #S\ . . . . . . . #Name\ . . . . . . . . ''''\ . . . . . . . '':=''\ . . . . . . . #E\ . . . . . . . . #T\ . . . . . . . . . #P\ . . . . . . . . . . #Name\ . . . . . . . . . . . ''''\ . . . . . . . . . ''*''\ . . . . . . . . . #T\ . . . . . . . . . . #P\ . . . . . . . . . . . ''(''\ . . . . . . . . . . . #E\ . . . . . . . . . . . . #E\ . . . . . . . . . . . . . #T\ . . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . . #Name\ . . . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . . ''+''\ . . . . . . . . . . . . #T\ . . . . . . . . . . . . . #P\ . . . . . . . . . . . . . . ''''\ . . . . . . . . . . . '')''\ . . . . . . . '';''\ . . ''end''\' withCRs ) compareSASTTo: (Array with: '#Program\ . #Decls\ . . #IdList\ . . . ''a''\ . . . ''b''\ . . . ''c''\ . #Stmts\ . . #StmtList\ . . . #Assign\ . . . . ''a''\ . . . . ''3''\ . . . #Assign\ . . . . ''b''\ . . . . #Times\ . . . . . ''a''\ . . . . . #Times\ . . . . . . ''4''\ . . . . . . ''5''\ . . . #Stmts\ . . . . #StmtList\ . . . . . #Assign\ . . . . . . ''c''\ . . . . . . #Plus\ . . . . . . . ''a''\ . . . . . . . #Times\ . . . . . . . . ''b''\ . . . . . . . . ''19''\ . . . . . #Assign\ . . . . . . ''b''\ . . . . . . #Plus\ . . . . . . . #Times\ . . . . . . . . ''b''\ . . . . . . . . ''c''\ . . . . . . . ''1''\ . . . . . #Assign\ . . . . . . ''a''\ . . . . . . #Times\ . . . . . . . #Plus\ . . . . . . . . ''a''\ . . . . . . . . ''1''\ . . . . . . . ''a''\ . . . #Assign\ . . . . ''c''\ . . . . #Times\ . . . . . ''b''\ . . . . . #Plus\ . . . . . . ''c''\ . . . . . . ''5''\' withCRs ) tokenSpec: ' : [a-z]+ ; : [0-9]+ ; : [\s\t\r]+ {ignoreDelimiter} ; ' grammarSpec: ' Z : ''program'' Decls Stmts {Program} ; Decls : ''var'' IdList '':'' ''integer'' {Decls} ; IdList : Name IdList {liftRightChild} ; IdList : Name {IdList} ; Stmts : ''begin'' SL ''end'' {Stmts} ; SL : S SL {liftRightChild} ; SL : Stmts SL {liftRightChild} ; SL : S {StmtList} ; SL : Stmts {StmtList} ; S : Name '':='' E '';'' {Assign} ; E : E ''+'' T {Plus} ; E : T ; T : P ''*'' T {Times} ; T : P; P : ''('' E '')'' ; P : Name ; P : {Number} ; Name : {Id} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest3 "TranslatorGenerator basicLRParserGenerationTest3" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 3'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( 'a' 'a + b * c + a' ) compareDTTo: (Array with: '#E\ . #T\ . . #P\ . . . ''a''\ . . #Tc\ . . . ''''\ . #Ec\ . . ''''\' withCRs with: '#E\ . #T\ . . #P\ . . . ''a''\ . . #Tc\ . . . ''''\ . #Ec\ . . ''+''\ . . #E\ . . . #T\ . . . . #P\ . . . . . ''b''\ . . . . #Tc\ . . . . . ''*''\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''c''\ . . . . . . #Tc\ . . . . . . . ''''\ . . . #Ec\ . . . . ''+''\ . . . . #E\ . . . . . #T\ . . . . . . #P\ . . . . . . . ''a''\ . . . . . . #Tc\ . . . . . . . ''''\ . . . . . #Ec\ . . . . . . ''''\' withCRs ) compareSASTTo: (Array with: '#A\' withCRs with: '#Plus\ . #A\ . #Plus\ . . #Times\ . . . #B\ . . . #C\ . . #A\' withCRs ) tokenSpec: ' : [\s\t\r]+ {ignoreDelimiter} ; ' grammarSpec: ' E : T Ec {liftRightChild} ; Ec : ''+'' E {Plus} ; Ec : {nil} ; T : P Tc {liftRightChild} ; Tc : ''*'' T {Times} ; Tc : {nil} ; P : ''a'' {A} ; P : ''b'' {B} ; P : ''c'' {C} ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest4 "TranslatorGenerator basicLRParserGenerationTest4" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 4'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( '(a ; a)' '(a , a)' ) compareDTTo: (Array with: '#E\ . #P\ . . ''(''\ . . #A\ . . . ''a''\ . . '';''\ . . #A\ . . . ''a''\ . . '')''\' withCRs with: '#E\ . #P\ . . ''(''\ . . #V\ . . . ''a''\ . . '',''\ . . #V\ . . . ''a''\ . . '')''\' withCRs ) tokenSpec: ' : [\s\t\r]+ {ignoreDelimiter} ; ' grammarSpec: ' E : P ; P : ''a'' ; P : ''('' A '';'' A '')'' ; P : ''('' V '','' V '')'' ; V : ''a'' ; A : ''a'' ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest5 "TranslatorGenerator basicLRParserGenerationTest5" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 5'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( 'aab' 'aaa' 'baa' 'bab' ) compareDTTo: (Array with: '#S\ . ''a''\ . #B\ . . #A\ . . . ''a''\ . ''b''\' withCRs with: '#S\ . ''a''\ . #D\ . . ''a''\ . ''a''\' withCRs with: '#S\ . ''b''\ . #B\ . . #A\ . . . ''a''\ . ''a''\' withCRs with: '#S\ . ''b''\ . #D\ . . ''a''\ . ''b''\' withCRs ) tokenSpec: '' grammarSpec: ' S : ''a'' B ''b'' ; S : ''a'' D ''a'' ; S : ''b'' B ''a'' ; S : ''b'' D ''b'' ; B : A ; A : ''a'' ; D : ''a'' ; ' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicLRParserGenerationTest6 "TranslatorGenerator basicLRParserGenerationTest6" | tgen failBlock testName | testName := 'T-gen LR Parser Generation Test 6'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #() compareDTTo: #() tokenSpec: '' grammarSpec: ' S : E ; E : E ''+'' E | E ''*'' E | ''a'' ;' ifFail: failBlock. (tgen isLL1 | tgen isSLR1 | tgen isLALR1 | tgen isLR1) ifTrue: failBlock ifFalse: [Transcript show: '*']. Transcript cr; show: 'STOP: ' , testName! basicScannerTest1 "TranslatorGenerator basicScannerTest1" | tgen failBlock testName | testName := 'T-gen Scanner Test 1'. tgen := self new setGrammarModeToLR. tgen scannerClass: FSABasedScannerWithOneTokenLookahead. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( 'abc' 'abd' ) compareDTTo: (Array with: '#S\ . #E\ . . ''abc''\ . #S\ . . ''''\' withCRs with: '#S\ . #E\ . . ''a''\ . #S\ . . #E\ . . . ''bd''\ . . #S\ . . . ''''\' withCRs ) tokenSpec: '' grammarSpec: 'S : E S | ; E : ''a'' | ''abc'' | ''bd'' ;' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! basicScannerTest2 "TranslatorGenerator basicScannerTest2" | tgen failBlock testName | testName := 'T-gen Scanner Test 2'. tgen := self new setGrammarModeToLR. tgen scannerClass: FSABasedScannerWithTwoTokenLookahead. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen parseInputs: #( 'abc' 'abd' 'abbd' 'a' ) compareDTTo: (Array with: '#S\ . #E\ . . ''abc''\ . #S\ . . ''''\' withCRs with: '#S\ . #E\ . . ''a''\ . #S\ . . #E\ . . . ''bd''\ . . #S\ . . . ''''\' withCRs with: '#S\ . #E\ . . ''ab''\ . #S\ . . #E\ . . . ''bd''\ . . #S\ . . . ''''\' withCRs with: '#S\ . #E\ . . ''a''\ . #S\ . . ''''\' withCRs ) tokenSpec: '' grammarSpec: 'S : E S | ; E : ''a'' | ''ab'' | ''abc'' | ''bd'' ;' ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! rrpgToCfgTransformationsTest1 "TranslatorGenerator rrpgToCfgTransformationsTest1" | tgen failBlock testName | testName := 'T-gen RRPG-to-CFG Transformation Test 1'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen tokenSpecification: ''. tgen grammarSpec: 'S : ''b''+ ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' S0 ;\S0 : ''b'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''+ ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' S0 ;\S0 : ''b'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b''+ ''c'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' S0 ;\S0 : ''b'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''+ ''c'' ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' S0 ;\S0 : ''b'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b''* ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' S0 ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''* ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' S0 ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b''* ''c'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' S0 ;\S0 : ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''* ''c'' ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' S0 ;\S0 : ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b''? ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''? ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b''? ''c'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' ''c'' ;\S0 : ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b''? ''c'' ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' ''c'' ;\S0 : ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b'' ^ ''d'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' ;\S0 : ''b'' ''d'' S0 ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b'' ^ ''d'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''a'' ''b'' ;\S0 : ''a'' ''b'' ''d'' S0 ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b'' ^ ''d'' ''c'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''b'' ;\S0 : ''b'' ''d'' ''c'' S0 ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b'' ^ ''d'' ''c'' ;\' withCRs targetGrammar: 'S : S0 ;\S0 : ''a'' ''b'' ;\S0 : ''a'' ''b'' ''d'' ''c'' S0 ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b'' | ''d'' ;\' withCRs targetGrammar: 'S : ''b'' ;\S : ''d'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b'' | ''d'' ;\' withCRs targetGrammar: 'S : ''a'' ''b'' ;\S : ''d'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''b'' | ''d'' ''c'' ;\' withCRs targetGrammar: 'S : ''b'' ;\S : ''d'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b'' | ''d'' ''c'' ;\' withCRs targetGrammar: 'S : ''a'' ''b'' ;\S : ''d'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : (''b'' | ''d'') ;\' withCRs targetGrammar: 'S : ''b'' ;\S : ''d'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' (''b'' | ''d'') ;\' withCRs targetGrammar: 'S : ''a'' ''b'' ;\S : ''a'' ''d'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : (''b'' | ''d'') ''c'' ;\' withCRs targetGrammar: 'S : ''b'' ''c'' ;\S : ''d'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' (''b'' | ''d'') ''c'' ;\' withCRs targetGrammar: 'S : ''a'' ''b'' ''c'' ;\S : ''a'' ''d'' ''c'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : A B+ ;\A : ''a'' ;\B : ''b'' ;\' withCRs targetGrammar: 'S : A S0 ;\S0 : B S0 ;\S0 : B ;\A : ''a'' ;\B : ''b'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : A B* ;\A : ''a'' ;\B : ''b'' ;\' withCRs targetGrammar: 'S : A S0 ;\S0 : B S0 ;\S0 : ;\A : ''a'' ;\B : ''b'' ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : A B? ;\A : ''a'' ;\B : ''b'' ;\' withCRs targetGrammar: 'S : A S0 ;\S0 : B ;\S0 : ;\A : ''a'' ;\B : ''b'' ;\' withCRs ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! rrpgToCfgTransformationsTest2 "TranslatorGenerator rrpgToCfgTransformationsTest2" | tgen failBlock testName | testName := 'T-gen RRPG-to-CFG Transformation Test 2'. tgen := self new setGrammarModeToLR. failBlock := [self error: testName, ' failed.']. Transcript cr; show: 'START: ' , testName; cr. tgen tokenSpecification: ''. tgen grammarSpec: 'S : ''a'' (''b'' | ''d'')? ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : ''b'' ;\S0 : ''d'' ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' ''b'' | ''d''? ;\' withCRs targetGrammar: 'S : ''a'' ''b'' ;\S : S0 ;\S0 : ''d'' ;\S0 : ;\' withCRs ifFail: failBlock. tgen grammarSpec: 'S : ''a'' (B ^ C)? ;\B : ''b'' ;\C : ''c'' ;\' withCRs targetGrammar: 'S : ''a'' S0 ;\S0 : S00 ;\S00 : B ;\S00 : B C S00 ;\S0 : ;\B : ''b'' ;\C : ''c'' ;\' withCRs ifFail: failBlock. Transcript cr; show: 'STOP: ' , testName! runAllTests "TranslatorGenerator runAllTests" Transcript cr; show: 'T-gen TEST SUITE (answer ''yes'' to all prompters)'. self basicLLParserGenerationTest1. self basicLLParserGenerationTest2. self basicLLParserGenerationTest3. self basicLRParserGenerationTest1. self basicLRParserGenerationTest2. self basicLRParserGenerationTest3. self basicLRParserGenerationTest4. self basicLRParserGenerationTest5. self basicLRParserGenerationTest6. self basicScannerTest1. self basicScannerTest2. self rrpgToCfgTransformationsTest1. self rrpgToCfgTransformationsTest2. Transcript cr; show: 'ALL TESTS PASSED'; cr.! !