L'entête du fichier .jj que j'utilise:
C'est le même chez vous? Si non , tu serais prêt à me passer ton .jj? en échange d'amélioration et de debug éventuel (je vais travailler avec OpenCobol et MicroFocus en compilo par la suite, le tout en LGPL donc tout reste dispo 8-))Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 /** * This is an experimental COBOL-85 grammar for JavaCC. * <p>References used for this grammar :<ol> * <li> Ralf Lämmel & Chris Verhoef : VS COBOL II grammar Version 1.0.3 * <li> Fujitsu Cobol compiler reference * <li> Compaq-HP Non-stop Cobol reference * </od> * <p>This grammar is released under the GNU Library Public License (LGPL). * <p><address>Bernard Pinon, august 2002</address> * @see http://www.gnu.org/licenses/lgpl.html * @see http://www.cwi.nl/ * @see http://www.wins.uva.nl/ * @author Bernard Pinon (bpinon at benjamin dash media dot com) * * <p>History:<ul> * <li><date>9-aug-2002</date> [BP] make changes to comply with JTB :<ol> * <li> Changed Integer() to IntegerConstant() to avoid conflicts with java.lang.Integer * <li> Removed Java code to make the grammar bare bone * <li> Fixed Identification Division entries * </ol> * <li><date>8-aug-2002</date> [BP] fixed several bugs :<ol> * <li> INSTALLATION section * <li> wrong spelling in keywords * <li> DOT missing in FD/SD entries * <li> wrong regular expressions for levels * <li> possibility to have repeated string literals, e.g. "AA" "BB" -> "AABB" * <li> optimized data division by placing the most common clauses first * <li> DOT missing in exit statement * <li> confusion between Identifier and QualifiedDataName (to be checked) * <li> fixed NumericConstant to use Integer instead of INTEGER * <li> Correcting AdvancingPhrase so LINE is optional * <li> Fixed problems with abbreviated conditions * <li> Fixed Add statement * </ol> * </ul> */ /** * Cobol is not case sensitive. It is not LL(1) neither... */ options { STATIC=false; IGNORE_CASE = true; FORCE_LA_CHECK = true; LOOKAHEAD = 4; DEBUG_PARSER = true; DEBUG_LOOKAHEAD = true; }
Et les commandes que j'ai lancé:
Je suis passé en non statique mais cela ne change rien :?Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 fgardes@ebm-25:~/data/cobconnect/parsercobol/src/org/objectweb/petals/parsercobol$ javacc cobol.jj Java Compiler Compiler Version 4.1d1 (Parser Generator) (type "javacc" with no arguments for help) Reading from file cobol.jj . . . ... Parser generated with 0 errors and 130 warnings. fgardes@ebm-25:~/data/cobconnect/parsercobol/src/org/objectweb/petals/parsercobol$java -jar ../../../../../lib/jtb132.jar -jd -f -pp -tk -printer -o jtb.cobol.jj -p org.objectweb.petals.parsercobol cobol.jj JTB version 1.3.2 JTB: Reading from cobol.jj... JTB: Input file parsed successfully. JTB: "jtb.cobol.jj" generated to current directory. JTB: Syntax tree Java source files generated to directory "syntaxtree". JTB: "GJVisitor.java" generated to directory "visitor". JTB: "Visitor.java" generated to directory "visitor". JTB: "GJNoArguVisitor.java" generated to directory "visitor". JTB: "GJVoidVisitor.java" generated to directory "visitor". JTB: "GJDepthFirst.java" generated to directory "visitor". JTB: "DepthFirstVisitor.java" generated to directory "visitor". JTB: "GJNoArguDepthFirst.java" generated to directory "visitor". JTB: "GJVoidDepthFirst.java" generated to directory "visitor". JTB: "TreeDumper.java" generated to directory "visitor". JTB: "TreeFormatter.java" already exists. Won't overwrite. fgardes@ebm-25:~/data/cobconnect/parsercobol/src/org/objectweb/petals/parsercobol$
Tu pourrais me montrer la signature de ta méthode générée CompilationUnit()?
Je dois faire quelque chose de pas bon avec JavaCC....
Et j'ai suivi les même étapes, en me référant aux liens donnés:
La grammaire
le parser