equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCConfiguration subclass:#PPCTokenizingConfiguration |
|
6 instanceVariableNames:'' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitCompiler-Core' |
|
10 ! |
|
11 |
|
12 !PPCTokenizingConfiguration methodsFor:'compiling'! |
|
13 |
|
14 invokePhases |
|
15 self toPPCIr. |
|
16 self createTokens. |
|
17 self cacheFirstFollow. |
|
18 self createLL1Choices. |
|
19 self tokenize. |
|
20 self merge. |
|
21 self specialize. |
|
22 self createRecognizingComponents. |
|
23 self specialize. |
|
24 self inline. |
|
25 self merge. |
|
26 self check. |
|
27 self cacheFirstFollow. |
|
28 self generate. |
|
29 ! ! |
|
30 |
|
31 !PPCTokenizingConfiguration methodsFor:'hooks'! |
|
32 |
|
33 codeCompilerOn: args |
|
34 ^ PPCTokenizingCompiler on: args |
|
35 ! |
|
36 |
|
37 codeGeneratorVisitorOn: compiler |
|
38 ^ PPCTokenizingCodeGenerator on: compiler |
|
39 ! ! |
|
40 |
|
41 !PPCTokenizingConfiguration methodsFor:'phases'! |
|
42 |
|
43 createLL1Choices |
|
44 ir := PPCLL1Visitor new |
|
45 arguments: arguments; |
|
46 visit: ir. |
|
47 self remember: #LL1 |
|
48 ! |
|
49 |
|
50 tokenize |
|
51 " |
|
52 This will try transform the parser into the tokenizing parser |
|
53 " |
|
54 arguments tokenize ifFalse: [ ^ self ] . |
|
55 |
|
56 ir := PPCTokenizingVisitor new |
|
57 arguments: arguments; |
|
58 visit: ir. |
|
59 self remember: #tokenize |
|
60 ! ! |
|
61 |