compiler/PPCUniversalConfiguration.st
changeset 534 a949c4fe44df
parent 532 132d7898a2a1
equal deleted inserted replaced
533:666372dbe307 534:a949c4fe44df
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'PetitCompiler-Core'
     9 	category:'PetitCompiler-Core'
    10 !
    10 !
    11 
    11 
    12 
    12 
       
    13 !PPCUniversalConfiguration methodsFor:'accessing - defaults'!
       
    14 
       
    15 defaultParserSuperclass
       
    16     ^ PPCompiledParser
       
    17 
       
    18     "Modified: / 01-09-2015 / 08:47:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    19 ! !
       
    20 
    13 !PPCUniversalConfiguration methodsFor:'compiling'!
    21 !PPCUniversalConfiguration methodsFor:'compiling'!
    14 
    22 
    15 initialize
    23 invokePhases
    16     super initialize.
       
    17 
    24 
    18     "Modified: / 25-08-2015 / 00:03:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    25     self runPass: PPCTokenDetector.
    19 !
       
    20 
    26 
    21 invokePhases
    27     context options cacheFirstFollow ifTrue:[
    22     self toPPCIr.
    28         self runPass: PPCCacheFirstFollowPass  
    23     self createTokens.
    29     ].  
    24     self cacheFirstFollow.
    30     context options specialize ifTrue:[
    25     self specialize.
    31         self runPass: PPCSpecializingVisitor
    26     self createRecognizingComponents.
    32     ].  
    27     self specialize.
       
    28     self inline.
       
    29     self merge.
       
    30     self check.	
       
    31     self generate.
       
    32 ! !
       
    33 
    33 
    34 !PPCUniversalConfiguration methodsFor:'error handling'!
    34     self runPass: PPCRecognizerComponentDetector .
    35 
    35 
    36 buildClass
    36     context options specialize ifTrue:[
    37     | builder |
    37         self runPass: PPCSpecializingVisitor
       
    38     ].
       
    39     context options inline ifTrue:[
       
    40         self runPass: PPCInliningVisitor     
       
    41     ].
    38 
    42 
    39     self assert:(context parserClass isKindOf:PPCClass).
    43     self runPass: PPCMergingVisitor.
    40     builder := PPCClassBuilder new.
       
    41     builder compiledClassName:context options parserName.
       
    42     builder compiledSuperclass:PPCompiledParser.
       
    43     builder methodDictionary:context parserClass methodDictionary.
       
    44     builder constants:context parserClass constants.
       
    45     ^ builder compileClass.
       
    46 
    44 
    47     "Modified: / 25-08-2015 / 00:04:08 / Jan Vrany <jan.vrany@fit."
    45     self runPass: PPCCheckingVisitor.
    48     "Modified: / 26-08-2015 / 20:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    49 !
       
    50 
    46 
    51 generate
    47     self runPass: PPCUniversalCodeGenerator. 
    52     | compiledParser |
       
    53 
    48 
    54     context options generate ifFalse:[
    49     self generateParser.
    55         ^ self
       
    56     ].
       
    57     self runPass: PPCUniversalCodeGenerator.
       
    58 
    50 
    59     compiledParser := self buildClass.
    51     "Modified: / 04-09-2015 / 10:25:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    60     compiledParser startSymbol:(context parserClass propertyAt:#rootMethod) methodName.
       
    61     compiledParser := compiledParser new.
       
    62     ir := compiledParser.
       
    63 
       
    64     "Modified: / 25-08-2015 / 00:03:46 / Jan Vrany <jan.vr"
       
    65     "Modified: / 26-08-2015 / 22:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    66 ! !
    52 ! !
    67 
    53 
    68 !PPCUniversalConfiguration class methodsFor:'documentation'!
    54 !PPCUniversalConfiguration class methodsFor:'documentation'!
    69 
    55 
    70 version
    56 version