compiler/PPCCompiler.st
changeset 538 16e8536f5cfb
parent 537 fb212e14d1f4
child 543 02d90f0038fd
equal deleted inserted replaced
537:fb212e14d1f4 538:16e8536f5cfb
    10 !
    10 !
    11 
    11 
    12 
    12 
    13 !PPCCompiler class methodsFor:'as yet unclassified'!
    13 !PPCCompiler class methodsFor:'as yet unclassified'!
    14 
    14 
    15 default
       
    16     ^ self universal
       
    17 !
       
    18 
       
    19 new
    15 new
    20     ^ self basicNew
    16     ^ self basicNew initialize
    21         initialize;
    17 
    22         yourself
    18     "Modified: / 07-09-2015 / 11:06:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    23 !
    19 !
    24 
    20 
    25 tokenizing
    21 newWithOptions: options
    26     | options |
    22     ^ self new options: options
    27 
    23 
    28     options := PPCCompilationOptions default.
    24     "Created: / 07-09-2015 / 11:06:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    29     options tokenize:true.
       
    30     ^ (PPCCompiler new)
       
    31         options:options;
       
    32         yourself
       
    33 
       
    34     "Modified: / 04-09-2015 / 16:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    35 !
       
    36 
       
    37 universal
       
    38     | options |
       
    39 
       
    40     options := PPCCompilationOptions default.
       
    41     options tokenize:false.
       
    42     ^ (PPCCompiler new)
       
    43         options:options;
       
    44         yourself
       
    45 
       
    46     "Modified: / 04-09-2015 / 16:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    47 ! !
    25 ! !
    48 
    26 
    49 !PPCCompiler methodsFor:'accessing'!
    27 !PPCCompiler methodsFor:'accessing'!
    50 
    28 
    51 context
    29 context
    56     ^ context options
    34     ^ context options
    57 
    35 
    58     "Modified: / 26-08-2015 / 19:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    36     "Modified: / 26-08-2015 / 19:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    59 !
    37 !
    60 
    38 
    61 options: aPPCCompilationOptions
    39 options: options
    62     context options: aPPCCompilationOptions
    40     context options: options
    63 
    41 
    64     "Created: / 26-08-2015 / 19:56:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    42     "Created: / 26-08-2015 / 19:56:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    65 !
    43 !
    66 
    44 
    67 passes
    45 passes
   131 ! !
   109 ! !
   132 
   110 
   133 !PPCCompiler methodsFor:'compiling'!
   111 !PPCCompiler methodsFor:'compiling'!
   134 
   112 
   135 compile: aPPParser
   113 compile: aPPParser
       
   114     "Compiles given parser. Return an *instance* of the compiler
       
   115      parser which is ready to use (repeatedly)"
       
   116 
   136     | time |
   117     | time |
   137     self input: aPPParser.
   118     self input: aPPParser.    
   138     
       
   139     time := [ self compile ] timeToRun.
   119     time := [ self compile ] timeToRun.
   140     ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifFalse:[ 
   120     ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifFalse:[ 
   141         "Assume Pharo"
   121         "Assume Pharo"
   142         time := time asMilliSeconds.
   122         time := time asMilliSeconds.
   143     ].
   123     ].
   144     self reportTime: time.
   124     self reportTime: time.
   145     
   125     
   146     ^ ir
   126     ^ ir
   147 
   127 
   148     "Modified: / 17-08-2015 / 13:06:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   128     "Modified: / 17-08-2015 / 13:06:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   129     "Modified (comment): / 07-09-2015 / 10:49:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   149 ! !
   130 ! !
   150 
   131 
   151 !PPCCompiler methodsFor:'initialization'!
   132 !PPCCompiler methodsFor:'initialization'!
   152 
   133 
   153 initialize
   134 initialize