compiler/PPCCompilationOptions.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 04 Sep 2015 14:06:56 +0100
changeset 535 a8feb0f47574
parent 534 a949c4fe44df
child 538 16e8536f5cfb
permissions -rw-r--r--
PPCConfiguration refactoring: [7/10]: allow to configure passes ...run during compilation by setting a collection of passes to run. Got rid of PPCPluggableConfiguration and PPCConfiguration subclasses. Removed a bunch of options used to suppress certain passes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/petitparser/compiler' }"
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
     5
Object subclass:#PPCCompilationOptions
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
     6
	instanceVariableNames:'options'
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'PetitCompiler-Core'
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
    12
!PPCCompilationOptions class methodsFor:'as yet unclassified'!
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
default
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
    15
    ^ self new
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
new
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
    19
    ^ self basicNew 
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
    20
        initialize;
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
    21
        yourself
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
! !
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
533
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    24
!PPCCompilationOptions methodsFor:'initialization'!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    25
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    26
initialize
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    27
    super initialize.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    28
    options := IdentityDictionary new
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    29
! !
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    30
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    31
!PPCCompilationOptions methodsFor:'options'!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    32
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    33
mode
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    34
    ^ self at: #mode ifAbsent: #JIT
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    35
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    36
    "Created: / 26-08-2015 / 23:18:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    37
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    38
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    39
mode: mode
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    40
    "Set the compilation mode - valid values are #JIT or #AOT.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    41
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    42
     #JIT mode put less constraints on the original pure PetitParser
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    43
       parser (such as action blocks are not required to be purely functional,
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    44
       support mixing of compiled parsing code with custom PPParsers and so on).
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    45
       However, JIT-compiled parser class SHOULD NOT be commited into the
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    46
       repository - it won't work when loaded back. 
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    47
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    48
     #AOT mode allows for parser to be pre-compiled and generated code
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    49
       to be commited to repository. Thus, the deployed application don't need
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    50
       to contain full PetitCompiler. However, this is at cost of more contraints
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    51
       being put on the original Petit Parser. In other words, not all PetitParser
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    52
       parser may be compiled in AOT mode.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    53
       WARNING: #AOT mode is not yet fully supported, do not use!!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    54
    "
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    55
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    56
    (#(JIT AOT) includes: mode) ifFalse:[ 
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    57
        PPCCompilationError new signal: 'Invalid mode: option value - must be either #JIT or #AOT'.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    58
    ].
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    59
    mode == #AOT ifTrue:[ 
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    60
        PPCCompilationWarning new signal: '#AOT mode not yet supported'.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    61
    ].
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    62
    self at: #mode put: mode
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    63
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    64
    "Created: / 26-08-2015 / 23:07:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    65
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    66
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    67
parserName
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    68
    ^ self at: #parserName ifAbsent: #PPGeneratedParser
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    69
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    70
    "Modified (format): / 26-08-2015 / 23:04:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    71
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    72
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    73
parserName: aSymbol
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    74
    "Sets the name of the generated parser class.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    75
     Defaults to #PPGeneratedParser."
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    76
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    77
    self set: #parserName to: aSymbol.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    78
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    79
    "Modified (comment): / 26-08-2015 / 23:05:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    80
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    81
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    82
scannerName
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    83
    ^ self at: #scannerName ifAbsent: #PPGeneratedScanner
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    84
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    85
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    86
scannerName: value
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    87
    "Sets the name of the generated parser class.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    88
     Defaults to #PPGeneratedScanner."    
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    89
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    90
    self set: #scannerName to: value.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    91
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    92
    "Modified (comment): / 26-08-2015 / 23:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    93
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    94
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    95
tokenize
535
a8feb0f47574 PPCConfiguration refactoring: [7/10]: allow to configure passes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 534
diff changeset
    96
    ^ self at: #tokenize ifAbsent: false
a8feb0f47574 PPCConfiguration refactoring: [7/10]: allow to configure passes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 534
diff changeset
    97
a8feb0f47574 PPCConfiguration refactoring: [7/10]: allow to configure passes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 534
diff changeset
    98
    "Modified: / 04-09-2015 / 15:53:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
533
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
    99
!
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   100
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   101
tokenize: aBoolean
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   102
    "Build tokenizing parser, i.e., build scanner that tokenizes the input and then
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   103
     parser consuming tokens produced by scanner.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   104
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   105
     Tokenizing parser more resemble hand-written top-down parser and
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   106
     makes hand-tuning of the parser / scanner easier. However, not all
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   107
     PetitParsers may be tokenized.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   108
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   109
     Default value is true. If the compilation fails, try to set it to
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   110
     false
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   111
    "    
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   112
    self set: #tokenize to: aBoolean.
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   113
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   114
    "Modified (comment): / 26-08-2015 / 23:24:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   115
! !
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   116
666372dbe307 PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 529
diff changeset
   117
!PPCCompilationOptions methodsFor:'options - undocumented (do not use)'!
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
debug
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   120
    ^ self at: #debug ifAbsent: true
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
debug: value
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   124
    self set: #debug to: value.
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   125
!
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   126
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
generate
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   128
    ^ self at: #generate ifAbsent: true
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   129
!
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   130
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   131
generate: value
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   132
    ^ self set: #generate to: value
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
guards
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   136
    ^ self at: #guards ifAbsent: true
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
guards: value
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   140
    self set: #guards to: value.
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
534
a949c4fe44df PPCConfiguration refactoring: [6/10]: use #runPass: instead of self-sends.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 533
diff changeset
   143
parserSuperclass
a949c4fe44df PPCConfiguration refactoring: [6/10]: use #runPass: instead of self-sends.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 533
diff changeset
   144
    ^ self at: #parserSuperclass ifAbsent: nil
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
535
a8feb0f47574 PPCConfiguration refactoring: [7/10]: allow to configure passes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 534
diff changeset
   146
    "Modified: / 04-09-2015 / 16:06:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   147
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   148
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   149
parserSuperclass: value
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   150
    self set: #parserSuperclass to: value.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   151
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   152
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
profile
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   154
    ^ self at: #profile ifAbsent: false
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
profile: value
452
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   158
    self set: #profile to: value.
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   159
!
9f4558b3be66 Updated to PetitCompiler-JanKurs.111, PetitCompiler-Tests-JanKurs.51, PetitCompiler-Benchmarks-JanKurs.7, added PetitCompiler-Extras-Tests-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 438
diff changeset
   160
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   161
scannerSuperclass
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   162
    ^ self at: #scannerSuperclass ifAbsent: PPCDistinctScanner
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   163
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   164
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   165
scannerSuperclass: value
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 502
diff changeset
   166
    self set: #scannerSuperclass to: value.
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
! !
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   169
!PPCCompilationOptions methodsFor:'private'!
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
at: symbol ifAbsent: defaultValue
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   172
    ^ options at: symbol ifAbsent: [ ^ defaultValue  ]
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
!
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
set: symbol to: defaultValue
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   176
    ^ options at: symbol put: defaultValue 
438
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
! !
20598d7ce9fa Updated to PetitCompiler-JanKurs.100, PetitCompiler-Tests-JanKurs.44 and PetitCompiler-Benchmarks-JanKurs.4
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178