[Tinyos-2-commits] CVS: tinyos-2.x-contrib/timetossim/tinyos-2.x/tools/cgram/grammars CSymbolTable.java, NONE, 1.1 CToken.java, NONE, 1.1 GNUCTokenTypes.java, NONE, 1.1 GNUCTokenTypes.txt, NONE, 1.1 GnuCEmitter.g, NONE, 1.1 GnuCEmitter.java, NONE, 1.1 GnuCEmitter.smap, NONE, 1.1 GnuCEmitterTokenTypes.java, NONE, 1.1 GnuCEmitterTokenTypes.txt, NONE, 1.1 GnuCLexer.java, NONE, 1.1 GnuCLexer.smap, NONE, 1.1 GnuCLexerTokenTypes.java, NONE, 1.1 GnuCLexerTokenTypes.txt, NONE, 1.1 GnuCParser.g, NONE, 1.1 GnuCParser.java, NONE, 1.1 GnuCParser.smap, NONE, 1.1 GnuCTreeParser.g, NONE, 1.1 GnuCTreeParser.java, NONE, 1.1 GnuCTreeParser.smap, NONE, 1.1 GnuCTreeParserTokenTypes.java, NONE, 1.1 GnuCTreeParserTokenTypes.txt, NONE, 1.1 LineObject.java, NONE, 1.1 Makefile, NONE, 1.1 PreprocessorInfoChannel.java, NONE, 1.1 STDCTokenTypes.java, NONE, 1.1 STDCTokenTypes.txt, NONE, 1.1 StdCLexer.java, NONE, 1.1 StdCLexer.smap, NONE, 1.1 StdCParser.g, NONE, 1.1 StdCParser.java, NONE, 1.1 StdCParser.smap, NONE, 1.1 TNode.java, NONE, 1.1 TNodeFactory.java, NONE, 1.1 expandedGnuCEmitter.g, NONE, 1.1 expandedGnuCParser.g, NONE, 1.1
Muhammad Hamad Alizai
alizai at users.sourceforge.net
Fri Sep 19 09:08:31 PDT 2008
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x-contrib/timetossim/tinyos-2.x/tools/cgram/examples AsmParser.java, NONE, 1.1 FileList.java, NONE, 1.1 Line.java, NONE, 1.1 Makefile, NONE, 1.1 Postmartem.java, NONE, 1.1 PreMica2.java, NONE, 1.1 PreTossim.java, NONE, 1.1 Preprocessor.java, NONE, 1.1 SourceFile.java, NONE, 1.1 SourceLine.java, NONE, 1.1 TempTest.java, NONE, 1.1 Test.java, NONE, 1.1 TestLex.java, NONE, 1.1 TestThrough.java, NONE, 1.1 TestThrough.java~, NONE, 1.1 check_time3.c, NONE, 1.1 check_time3b.c, NONE, 1.1 tTossim.jar, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/sf serialsource.c, 1.2, 1.3 serialsource.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x-contrib/timetossim/tinyos-2.x/tools/cgram/grammars
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6212/tinyos-2.x/tools/cgram/grammars
Added Files:
CSymbolTable.java CToken.java GNUCTokenTypes.java
GNUCTokenTypes.txt GnuCEmitter.g GnuCEmitter.java
GnuCEmitter.smap GnuCEmitterTokenTypes.java
GnuCEmitterTokenTypes.txt GnuCLexer.java GnuCLexer.smap
GnuCLexerTokenTypes.java GnuCLexerTokenTypes.txt GnuCParser.g
GnuCParser.java GnuCParser.smap GnuCTreeParser.g
GnuCTreeParser.java GnuCTreeParser.smap
GnuCTreeParserTokenTypes.java GnuCTreeParserTokenTypes.txt
LineObject.java Makefile PreprocessorInfoChannel.java
STDCTokenTypes.java STDCTokenTypes.txt StdCLexer.java
StdCLexer.smap StdCParser.g StdCParser.java StdCParser.smap
TNode.java TNodeFactory.java expandedGnuCEmitter.g
expandedGnuCParser.g
Log Message:
All files added
--- NEW FILE: CSymbolTable.java ---
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
public class CSymbolTable {
/** holds list of scopes */
private Vector scopeStack;
/** table where all defined names are mapped to TNode tree nodes */
private Hashtable symTable;
public CSymbolTable() {
scopeStack = new Vector(10);
symTable = new Hashtable(533);
}
/** push a new scope onto the scope stack.
*/
public void pushScope(String s) {
//System.out.println("push scope:" + s);
scopeStack.addElement(s);
}
/** pop the last scope off the scope stack.
*/
public void popScope() {
//System.out.println("pop scope");
int size = scopeStack.size();
if(size > 0)
scopeStack.removeElementAt(size - 1);
}
/** return the current scope as a string
*/
public String currentScopeAsString() {
StringBuffer buf = new StringBuffer(100);
boolean first = true;
Enumeration e = scopeStack.elements();
while(e.hasMoreElements()) {
if(first)
first = false;
else
buf.append("::");
buf.append(e.nextElement().toString());
}
return buf.toString();
}
/** given a name for a type, append it with the
current scope.
*/
public String addCurrentScopeToName(String name) {
String currScope = currentScopeAsString();
return addScopeToName(currScope, name);
}
/** given a name for a type, append it with the
given scope. MBZ
*/
public String addScopeToName(String scope, String name) {
if(scope == null || scope.length() > 0)
return scope + "::" + name;
else
return name;
}
/** remove one level of scope from name MBZ*/
public String removeOneLevelScope(String scopeName) {
int index = scopeName.lastIndexOf("::");
if (index > 0) {
return scopeName.substring(0,index);
}
if (scopeName.length() > 0) {
return "";
}
return null;
}
/** add a node to the table with it's key as
the current scope and the name */
public TNode add(String name, TNode node) {
return (TNode)symTable.put(addCurrentScopeToName(name),node);
}
/** lookup a fully scoped name in the symbol table */
public TNode lookupScopedName(String scopedName) {
return (TNode)symTable.get(scopedName);
}
/** lookup an unscoped name in the table by prepending
the current scope.
MBZ -- if not found, pop scopes and look again
*/
public TNode lookupNameInCurrentScope(String name) {
String scope = currentScopeAsString();
String scopedName;
TNode tnode = null;
//System.out.println( "\n"+ this.toString() );
while (tnode == null && scope != null) {
scopedName = addScopeToName(scope, name);
//System.out.println("lookup trying " + scopedName);
tnode = (TNode)symTable.get(scopedName);
scope = removeOneLevelScope(scope);
}
return tnode;
}
/** convert this table to a string */
public String toString() {
StringBuffer buff = new StringBuffer(300);
buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() +
"\nDefinedSymbols:\n");
Enumeration ke = symTable.keys();
Enumeration ve = symTable.elements();
while(ke.hasMoreElements()) {
buff.append(ke.nextElement().toString() + " (" +
TNode.getNameForType(((TNode)ve.nextElement()).getType()) + ")\n");
}
buff.append("}\n");
return buff.toString();
}
};
--- NEW FILE: CToken.java ---
import antlr.CommonToken;
public class CToken extends antlr.CommonToken {
String source = "";
int tokenNumber;
public String getSource()
{
return source;
}
public void setSource(String src)
{
source = src;
}
public int getTokenNumber()
{
return tokenNumber;
}
public void setTokenNumber(int i)
{
tokenNumber = i;
}
public String toString() {
return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ;
}
}
--- NEW FILE: GNUCTokenTypes.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCParser.g" -> "GnuCParser.java"$
public interface GNUCTokenTypes {
int EOF = 1;
int NULL_TREE_LOOKAHEAD = 3;
int LITERAL_typedef = 4;
int PREPROC_DIRECTIVE = 5;
int LITERAL_asm = 6;
int LITERAL_volatile = 7;
int LCURLY = 8;
int RCURLY = 9;
int SEMI = 10;
int LITERAL_struct = 11;
int LITERAL_union = 12;
int LITERAL_enum = 13;
int LITERAL_auto = 14;
int LITERAL_register = 15;
int LITERAL_extern = 16;
int LITERAL_static = 17;
int LITERAL_const = 18;
int LITERAL_void = 19;
int LITERAL_char = 20;
int LITERAL_short = 21;
int LITERAL_int = 22;
int LITERAL_long = 23;
int LITERAL_float = 24;
int LITERAL_double = 25;
int LITERAL_signed = 26;
int LITERAL___builtin_va_list = 27;
int LITERAL_unsigned = 28;
int ID = 29;
int COMMA = 30;
int COLON = 31;
int ASSIGN = 32;
int STAR = 33;
int LITERAL___restrict = 34;
int LPAREN = 35;
int RPAREN = 36;
int LBRACKET = 37;
int RBRACKET = 38;
int VARARGS = 39;
int LITERAL_while = 40;
int LITERAL_do = 41;
int LITERAL_for = 42;
int LITERAL_goto = 43;
int LITERAL_continue = 44;
int LITERAL_break = 45;
int LITERAL_return = 46;
int LITERAL_case = 47;
int LITERAL_default = 48;
int LITERAL_if = 49;
int LITERAL_else = 50;
int LITERAL_switch = 51;
int DIV_ASSIGN = 52;
int PLUS_ASSIGN = 53;
int MINUS_ASSIGN = 54;
int STAR_ASSIGN = 55;
int MOD_ASSIGN = 56;
int RSHIFT_ASSIGN = 57;
int LSHIFT_ASSIGN = 58;
int BAND_ASSIGN = 59;
int BOR_ASSIGN = 60;
int BXOR_ASSIGN = 61;
int QUESTION = 62;
int LOR = 63;
int LAND = 64;
int BOR = 65;
int BXOR = 66;
int BAND = 67;
int EQUAL = 68;
int NOT_EQUAL = 69;
int LT = 70;
int LTE = 71;
int GT = 72;
int GTE = 73;
int LSHIFT = 74;
int RSHIFT = 75;
int PLUS = 76;
int MINUS = 77;
int DIV = 78;
int MOD = 79;
int INC = 80;
int DEC = 81;
int LITERAL_sizeof = 82;
int BNOT = 83;
int LNOT = 84;
int PTR = 85;
int DOT = 86;
int CharLiteral = 87;
int StringLiteral = 88;
int IntOctalConst = 89;
int LongOctalConst = 90;
int UnsignedOctalConst = 91;
int IntIntConst = 92;
int LongIntConst = 93;
int UnsignedIntConst = 94;
int IntHexConst = 95;
int LongHexConst = 96;
int UnsignedHexConst = 97;
int FloatDoubleConst = 98;
int DoubleDoubleConst = 99;
int LongDoubleConst = 100;
int NTypedefName = 101;
int NInitDecl = 102;
int NDeclarator = 103;
int NStructDeclarator = 104;
int NDeclaration = 105;
int NCast = 106;
int NPointerGroup = 107;
int NExpressionGroup = 108;
int NFunctionCallArgs = 109;
int NNonemptyAbstractDeclarator = 110;
int NInitializer = 111;
int NStatementExpr = 112;
int NEmptyExpression = 113;
int NParameterTypeList = 114;
int NFunctionDef = 115;
int NCompoundStatement = 116;
int NParameterDeclaration = 117;
int NCommaExpr = 118;
int NUnaryExpr = 119;
int NLabel = 120;
int NPostfixExpr = 121;
int NRangeExpr = 122;
int NStringSeq = 123;
int NInitializerElementLabel = 124;
int NLcurlyInitializer = 125;
int NAsmAttribute = 126;
int NGnuAsmExpr = 127;
int NTypeMissing = 128;
int Vocabulary = 129;
int Whitespace = 130;
int Comment = 131;
int CPPComment = 132;
int Space = 133;
int LineDirective = 134;
int BadStringLiteral = 135;
int Escape = 136;
int Digit = 137;
int LongSuffix = 138;
int UnsignedSuffix = 139;
int FloatSuffix = 140;
int Exponent = 141;
int Number = 142;
int LITERAL___label__ = 143;
int LITERAL_inline = 144;
int LITERAL___inline = 145;
int LITERAL_typeof = 146;
int LITERAL___complex = 147;
int LITERAL___attribute = 148;
int LITERAL___alignof = 149;
int LITERAL___real = 150;
int LITERAL___imag = 151;
}
--- NEW FILE: GNUCTokenTypes.txt ---
// $ANTLR 2.7.6 (2005-12-22): expandedGnuCParser.g -> GNUCTokenTypes.txt$
GNUC // output token vocab name
LITERAL_typedef="typedef"=4
PREPROC_DIRECTIVE("a line directive")=5
LITERAL_asm="asm"=6
LITERAL_volatile="volatile"=7
LCURLY=8
RCURLY=9
SEMI=10
LITERAL_struct="struct"=11
LITERAL_union="union"=12
LITERAL_enum="enum"=13
LITERAL_auto="auto"=14
LITERAL_register="register"=15
LITERAL_extern="extern"=16
LITERAL_static="static"=17
LITERAL_const="const"=18
LITERAL_void="void"=19
LITERAL_char="char"=20
LITERAL_short="short"=21
LITERAL_int="int"=22
LITERAL_long="long"=23
LITERAL_float="float"=24
LITERAL_double="double"=25
LITERAL_signed="signed"=26
LITERAL___builtin_va_list="__builtin_va_list"=27
LITERAL_unsigned="unsigned"=28
ID=29
COMMA=30
COLON=31
ASSIGN=32
STAR=33
LITERAL___restrict="__restrict"=34
LPAREN=35
RPAREN=36
LBRACKET=37
RBRACKET=38
VARARGS=39
LITERAL_while="while"=40
LITERAL_do="do"=41
LITERAL_for="for"=42
LITERAL_goto="goto"=43
LITERAL_continue="continue"=44
LITERAL_break="break"=45
LITERAL_return="return"=46
LITERAL_case="case"=47
LITERAL_default="default"=48
LITERAL_if="if"=49
LITERAL_else="else"=50
LITERAL_switch="switch"=51
DIV_ASSIGN=52
PLUS_ASSIGN=53
MINUS_ASSIGN=54
STAR_ASSIGN=55
MOD_ASSIGN=56
RSHIFT_ASSIGN=57
LSHIFT_ASSIGN=58
BAND_ASSIGN=59
BOR_ASSIGN=60
BXOR_ASSIGN=61
QUESTION=62
LOR=63
LAND=64
BOR=65
BXOR=66
BAND=67
EQUAL=68
NOT_EQUAL=69
LT=70
LTE=71
GT=72
GTE=73
LSHIFT=74
RSHIFT=75
PLUS=76
MINUS=77
DIV=78
MOD=79
INC=80
DEC=81
LITERAL_sizeof="sizeof"=82
BNOT=83
LNOT=84
PTR=85
DOT=86
CharLiteral=87
StringLiteral=88
IntOctalConst=89
LongOctalConst=90
UnsignedOctalConst=91
IntIntConst=92
LongIntConst=93
UnsignedIntConst=94
IntHexConst=95
LongHexConst=96
UnsignedHexConst=97
FloatDoubleConst=98
DoubleDoubleConst=99
LongDoubleConst=100
NTypedefName=101
NInitDecl=102
NDeclarator=103
NStructDeclarator=104
NDeclaration=105
NCast=106
NPointerGroup=107
NExpressionGroup=108
NFunctionCallArgs=109
NNonemptyAbstractDeclarator=110
NInitializer=111
NStatementExpr=112
NEmptyExpression=113
NParameterTypeList=114
NFunctionDef=115
NCompoundStatement=116
NParameterDeclaration=117
NCommaExpr=118
NUnaryExpr=119
NLabel=120
NPostfixExpr=121
NRangeExpr=122
NStringSeq=123
NInitializerElementLabel=124
NLcurlyInitializer=125
NAsmAttribute=126
NGnuAsmExpr=127
NTypeMissing=128
Vocabulary=129
Whitespace=130
Comment=131
CPPComment=132
Space=133
LineDirective=134
BadStringLiteral=135
Escape=136
Digit=137
LongSuffix=138
UnsignedSuffix=139
FloatSuffix=140
Exponent=141
Number=142
LITERAL___label__="__label__"=143
LITERAL_inline="inline"=144
LITERAL___inline="__inline"=145
LITERAL_typeof="typeof"=146
LITERAL___complex="__complex"=147
LITERAL___attribute="__attribute"=148
LITERAL___alignof="__alignof"=149
LITERAL___real="__real"=150
LITERAL___imag="__imag"=151
--- NEW FILE: GnuCEmitter.g ---
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Non, Inc. 1998 -- All Rights Reserved
PROJECT: C Compiler
MODULE: GnuCEmitter
FILE: GnuCEmitter.g
AUTHOR: Monty Zukowski (jamz at cdsnet.net) April 28, 1998
DESCRIPTION:
This tree grammar is for a Gnu C AST.
It turns the tree back into source code.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
[...1582 lines suppressed...]
: IntOctalConst
| LongOctalConst
| UnsignedOctalConst
| IntIntConst
| LongIntConst
| UnsignedIntConst
| IntHexConst
| LongHexConst
| UnsignedHexConst
;
protected
floatConst
: FloatDoubleConst
| DoubleDoubleConst
| LongDoubleConst
;
--- NEW FILE: GnuCEmitter.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCEmitter.g" -> "GnuCEmitter.java"$
import antlr.TreeParser;
import antlr.Token;
import antlr.collections.AST;
import antlr.RecognitionException;
import antlr.ANTLRException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.collections.impl.BitSet;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;
import java.io.*;
import java.util.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
[...7436 lines suppressed...]
return data;
}
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
private static final long[] mk_tokenSet_1() {
long[] data = { 536623232L, 137438953472L, 786432L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
private static final long[] mk_tokenSet_2() {
long[] data = { 3376600208901152L, 76842668642009088L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
private static final long[] mk_tokenSet_3() {
long[] data = { -4503551845859328L, -5853953837898399745L, 2113536L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
}
--- NEW FILE: GnuCEmitter.smap ---
SMAP
GnuCEmitter.java
G
*S G
*F
+ 0 expandedGnuCEmitter.g
expandedGnuCEmitter.g
*L
18:25
19:26
20:27
21:28
22:29
23:30
24:31
25:32
26:33
27:34
28:35
[...5787 lines suppressed...]
1481:7259
1481:7260
1481:7261
1481:7262
1481:7263
1481:7264
1481:7265
1482:7268
1482:7269
1482:7270
1482:7271
1482:7272
1482:7273
1482:7274
1482:7275
1482:7276
1482:7277
1482:7278
1482:7279
*E
--- NEW FILE: GnuCEmitterTokenTypes.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCEmitter.g" -> "GnuCEmitter.java"$
public interface GnuCEmitterTokenTypes {
int EOF = 1;
int NULL_TREE_LOOKAHEAD = 3;
int LITERAL_typedef = 4;
int PREPROC_DIRECTIVE = 5;
int LITERAL_asm = 6;
int LITERAL_volatile = 7;
int LCURLY = 8;
int RCURLY = 9;
int SEMI = 10;
int LITERAL_struct = 11;
int LITERAL_union = 12;
int LITERAL_enum = 13;
int LITERAL_auto = 14;
int LITERAL_register = 15;
int LITERAL_extern = 16;
int LITERAL_static = 17;
int LITERAL_const = 18;
int LITERAL_void = 19;
int LITERAL_char = 20;
int LITERAL_short = 21;
int LITERAL_int = 22;
int LITERAL_long = 23;
int LITERAL_float = 24;
int LITERAL_double = 25;
int LITERAL_signed = 26;
int LITERAL___builtin_va_list = 27;
int LITERAL_unsigned = 28;
int ID = 29;
int COMMA = 30;
int COLON = 31;
int ASSIGN = 32;
int STAR = 33;
int LITERAL___restrict = 34;
int LPAREN = 35;
int RPAREN = 36;
int LBRACKET = 37;
int RBRACKET = 38;
int VARARGS = 39;
int LITERAL_while = 40;
int LITERAL_do = 41;
int LITERAL_for = 42;
int LITERAL_goto = 43;
int LITERAL_continue = 44;
int LITERAL_break = 45;
int LITERAL_return = 46;
int LITERAL_case = 47;
int LITERAL_default = 48;
int LITERAL_if = 49;
int LITERAL_else = 50;
int LITERAL_switch = 51;
int DIV_ASSIGN = 52;
int PLUS_ASSIGN = 53;
int MINUS_ASSIGN = 54;
int STAR_ASSIGN = 55;
int MOD_ASSIGN = 56;
int RSHIFT_ASSIGN = 57;
int LSHIFT_ASSIGN = 58;
int BAND_ASSIGN = 59;
int BOR_ASSIGN = 60;
int BXOR_ASSIGN = 61;
int QUESTION = 62;
int LOR = 63;
int LAND = 64;
int BOR = 65;
int BXOR = 66;
int BAND = 67;
int EQUAL = 68;
int NOT_EQUAL = 69;
int LT = 70;
int LTE = 71;
int GT = 72;
int GTE = 73;
int LSHIFT = 74;
int RSHIFT = 75;
int PLUS = 76;
int MINUS = 77;
int DIV = 78;
int MOD = 79;
int INC = 80;
int DEC = 81;
int LITERAL_sizeof = 82;
int BNOT = 83;
int LNOT = 84;
int PTR = 85;
int DOT = 86;
int CharLiteral = 87;
int StringLiteral = 88;
int IntOctalConst = 89;
int LongOctalConst = 90;
int UnsignedOctalConst = 91;
int IntIntConst = 92;
int LongIntConst = 93;
int UnsignedIntConst = 94;
int IntHexConst = 95;
int LongHexConst = 96;
int UnsignedHexConst = 97;
int FloatDoubleConst = 98;
int DoubleDoubleConst = 99;
int LongDoubleConst = 100;
int NTypedefName = 101;
int NInitDecl = 102;
int NDeclarator = 103;
int NStructDeclarator = 104;
int NDeclaration = 105;
int NCast = 106;
int NPointerGroup = 107;
int NExpressionGroup = 108;
int NFunctionCallArgs = 109;
int NNonemptyAbstractDeclarator = 110;
int NInitializer = 111;
int NStatementExpr = 112;
int NEmptyExpression = 113;
int NParameterTypeList = 114;
int NFunctionDef = 115;
int NCompoundStatement = 116;
int NParameterDeclaration = 117;
int NCommaExpr = 118;
int NUnaryExpr = 119;
int NLabel = 120;
int NPostfixExpr = 121;
int NRangeExpr = 122;
int NStringSeq = 123;
int NInitializerElementLabel = 124;
int NLcurlyInitializer = 125;
int NAsmAttribute = 126;
int NGnuAsmExpr = 127;
int NTypeMissing = 128;
int Vocabulary = 129;
int Whitespace = 130;
int Comment = 131;
int CPPComment = 132;
int Space = 133;
int LineDirective = 134;
int BadStringLiteral = 135;
int Escape = 136;
int Digit = 137;
int LongSuffix = 138;
int UnsignedSuffix = 139;
int FloatSuffix = 140;
int Exponent = 141;
int Number = 142;
int LITERAL___label__ = 143;
int LITERAL_inline = 144;
int LITERAL___inline = 145;
int LITERAL_typeof = 146;
int LITERAL___complex = 147;
int LITERAL___attribute = 148;
int LITERAL___alignof = 149;
int LITERAL___real = 150;
int LITERAL___imag = 151;
}
--- NEW FILE: GnuCEmitterTokenTypes.txt ---
// $ANTLR 2.7.6 (2005-12-22): expandedGnuCEmitter.g -> GnuCEmitterTokenTypes.txt$
GnuCEmitter // output token vocab name
LITERAL_typedef="typedef"=4
PREPROC_DIRECTIVE("a line directive")=5
LITERAL_asm="asm"=6
LITERAL_volatile="volatile"=7
LCURLY=8
RCURLY=9
SEMI=10
LITERAL_struct="struct"=11
LITERAL_union="union"=12
LITERAL_enum="enum"=13
LITERAL_auto="auto"=14
LITERAL_register="register"=15
LITERAL_extern="extern"=16
LITERAL_static="static"=17
LITERAL_const="const"=18
LITERAL_void="void"=19
LITERAL_char="char"=20
LITERAL_short="short"=21
LITERAL_int="int"=22
LITERAL_long="long"=23
LITERAL_float="float"=24
LITERAL_double="double"=25
LITERAL_signed="signed"=26
LITERAL___builtin_va_list="__builtin_va_list"=27
LITERAL_unsigned="unsigned"=28
ID=29
COMMA=30
COLON=31
ASSIGN=32
STAR=33
LITERAL___restrict="__restrict"=34
LPAREN=35
RPAREN=36
LBRACKET=37
RBRACKET=38
VARARGS=39
LITERAL_while="while"=40
LITERAL_do="do"=41
LITERAL_for="for"=42
LITERAL_goto="goto"=43
LITERAL_continue="continue"=44
LITERAL_break="break"=45
LITERAL_return="return"=46
LITERAL_case="case"=47
LITERAL_default="default"=48
LITERAL_if="if"=49
LITERAL_else="else"=50
LITERAL_switch="switch"=51
DIV_ASSIGN=52
PLUS_ASSIGN=53
MINUS_ASSIGN=54
STAR_ASSIGN=55
MOD_ASSIGN=56
RSHIFT_ASSIGN=57
LSHIFT_ASSIGN=58
BAND_ASSIGN=59
BOR_ASSIGN=60
BXOR_ASSIGN=61
QUESTION=62
LOR=63
LAND=64
BOR=65
BXOR=66
BAND=67
EQUAL=68
NOT_EQUAL=69
LT=70
LTE=71
GT=72
GTE=73
LSHIFT=74
RSHIFT=75
PLUS=76
MINUS=77
DIV=78
MOD=79
INC=80
DEC=81
LITERAL_sizeof="sizeof"=82
BNOT=83
LNOT=84
PTR=85
DOT=86
CharLiteral=87
StringLiteral=88
IntOctalConst=89
LongOctalConst=90
UnsignedOctalConst=91
IntIntConst=92
LongIntConst=93
UnsignedIntConst=94
IntHexConst=95
LongHexConst=96
UnsignedHexConst=97
FloatDoubleConst=98
DoubleDoubleConst=99
LongDoubleConst=100
NTypedefName=101
NInitDecl=102
NDeclarator=103
NStructDeclarator=104
NDeclaration=105
NCast=106
NPointerGroup=107
NExpressionGroup=108
NFunctionCallArgs=109
NNonemptyAbstractDeclarator=110
NInitializer=111
NStatementExpr=112
NEmptyExpression=113
NParameterTypeList=114
NFunctionDef=115
NCompoundStatement=116
NParameterDeclaration=117
NCommaExpr=118
NUnaryExpr=119
NLabel=120
NPostfixExpr=121
NRangeExpr=122
NStringSeq=123
NInitializerElementLabel=124
NLcurlyInitializer=125
NAsmAttribute=126
NGnuAsmExpr=127
NTypeMissing=128
Vocabulary=129
Whitespace=130
Comment=131
CPPComment=132
Space=133
LineDirective=134
BadStringLiteral=135
Escape=136
Digit=137
LongSuffix=138
UnsignedSuffix=139
FloatSuffix=140
Exponent=141
Number=142
LITERAL___label__="__label__"=143
LITERAL_inline="inline"=144
LITERAL___inline="__inline"=145
LITERAL_typeof="typeof"=146
LITERAL___complex="__complex"=147
LITERAL___attribute="__attribute"=148
LITERAL___alignof="__alignof"=149
LITERAL___real="__real"=150
LITERAL___imag="__imag"=151
--- NEW FILE: GnuCLexer.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCParser.g" -> "GnuCLexer.java"$
import java.io.InputStream;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import antlr.ANTLRException;
import java.io.Reader;
import java.util.Hashtable;
import antlr.CharScanner;
import antlr.InputBuffer;
import antlr.ByteBuffer;
import antlr.CharBuffer;
import antlr.Token;
import antlr.CommonToken;
import antlr.RecognitionException;
import antlr.NoViableAltForCharException;
[...2675 lines suppressed...]
for (int i = 2; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
private static final long[] mk_tokenSet_9() {
long[] data = new long[8];
data[0]=-4398046520321L;
for (int i = 1; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
private static final long[] mk_tokenSet_10() {
long[] data = new long[8];
data[0]=-9217L;
for (int i = 1; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
}
--- NEW FILE: GnuCLexer.smap ---
SMAP
GnuCLexer.java
G
*S G
*F
+ 0 expandedGnuCParser.g
expandedGnuCParser.g
*L
0:204
0:212
0:218
0:224
0:230
0:236
0:242
0:248
0:254
0:260
0:266
[...1819 lines suppressed...]
1338:2620
1338:2621
1338:2622
1338:2624
1338:2625
1338:2626
1338:2627
1338:2628
1338:2629
1341:2631
1341:2632
1341:2633
1341:2634
1341:2636
1341:2637
1341:2638
1341:2639
1341:2640
1341:2641
*E
--- NEW FILE: GnuCLexerTokenTypes.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCParser.g" -> "GnuCParser.java"$
public interface GnuCLexerTokenTypes {
int EOF = 1;
int NULL_TREE_LOOKAHEAD = 3;
int LITERAL_typedef = 4;
int PREPROC_DIRECTIVE = 5;
int LITERAL_asm = 6;
int LITERAL_volatile = 7;
int LCURLY = 8;
int RCURLY = 9;
int SEMI = 10;
int LITERAL_struct = 11;
int LITERAL_union = 12;
int LITERAL_enum = 13;
int LITERAL_auto = 14;
int LITERAL_register = 15;
int LITERAL_extern = 16;
int LITERAL_static = 17;
int LITERAL_const = 18;
int LITERAL_void = 19;
int LITERAL_char = 20;
int LITERAL_short = 21;
int LITERAL_int = 22;
int LITERAL_long = 23;
int LITERAL_float = 24;
int LITERAL_double = 25;
int LITERAL_signed = 26;
int LITERAL___builtin_va_list = 27;
int LITERAL_unsigned = 28;
int ID = 29;
int COMMA = 30;
int COLON = 31;
int ASSIGN = 32;
int STAR = 33;
int LITERAL___restrict = 34;
int LPAREN = 35;
int RPAREN = 36;
int LBRACKET = 37;
int RBRACKET = 38;
int VARARGS = 39;
int LITERAL_while = 40;
int LITERAL_do = 41;
int LITERAL_for = 42;
int LITERAL_goto = 43;
int LITERAL_continue = 44;
int LITERAL_break = 45;
int LITERAL_return = 46;
int LITERAL_case = 47;
int LITERAL_default = 48;
int LITERAL_if = 49;
int LITERAL_else = 50;
int LITERAL_switch = 51;
int DIV_ASSIGN = 52;
int PLUS_ASSIGN = 53;
int MINUS_ASSIGN = 54;
int STAR_ASSIGN = 55;
int MOD_ASSIGN = 56;
int RSHIFT_ASSIGN = 57;
int LSHIFT_ASSIGN = 58;
int BAND_ASSIGN = 59;
int BOR_ASSIGN = 60;
int BXOR_ASSIGN = 61;
int QUESTION = 62;
int LOR = 63;
int LAND = 64;
int BOR = 65;
int BXOR = 66;
int BAND = 67;
int EQUAL = 68;
int NOT_EQUAL = 69;
int LT = 70;
int LTE = 71;
int GT = 72;
int GTE = 73;
int LSHIFT = 74;
int RSHIFT = 75;
int PLUS = 76;
int MINUS = 77;
int DIV = 78;
int MOD = 79;
int INC = 80;
int DEC = 81;
int LITERAL_sizeof = 82;
int BNOT = 83;
int LNOT = 84;
int PTR = 85;
int DOT = 86;
int CharLiteral = 87;
int StringLiteral = 88;
int IntOctalConst = 89;
int LongOctalConst = 90;
int UnsignedOctalConst = 91;
int IntIntConst = 92;
int LongIntConst = 93;
int UnsignedIntConst = 94;
int IntHexConst = 95;
int LongHexConst = 96;
int UnsignedHexConst = 97;
int FloatDoubleConst = 98;
int DoubleDoubleConst = 99;
int LongDoubleConst = 100;
int NTypedefName = 101;
int NInitDecl = 102;
int NDeclarator = 103;
int NStructDeclarator = 104;
int NDeclaration = 105;
int NCast = 106;
int NPointerGroup = 107;
int NExpressionGroup = 108;
int NFunctionCallArgs = 109;
int NNonemptyAbstractDeclarator = 110;
int NInitializer = 111;
int NStatementExpr = 112;
int NEmptyExpression = 113;
int NParameterTypeList = 114;
int NFunctionDef = 115;
int NCompoundStatement = 116;
int NParameterDeclaration = 117;
int NCommaExpr = 118;
int NUnaryExpr = 119;
int NLabel = 120;
int NPostfixExpr = 121;
int NRangeExpr = 122;
int NStringSeq = 123;
int NInitializerElementLabel = 124;
int NLcurlyInitializer = 125;
int NAsmAttribute = 126;
int NGnuAsmExpr = 127;
int NTypeMissing = 128;
int Vocabulary = 129;
int Whitespace = 130;
int Comment = 131;
int CPPComment = 132;
int Space = 133;
int LineDirective = 134;
int BadStringLiteral = 135;
int Escape = 136;
int Digit = 137;
int LongSuffix = 138;
int UnsignedSuffix = 139;
int FloatSuffix = 140;
int Exponent = 141;
int Number = 142;
int LITERAL___label__ = 143;
int LITERAL_inline = 144;
int LITERAL___inline = 145;
int LITERAL_typeof = 146;
int LITERAL___complex = 147;
int LITERAL___attribute = 148;
int LITERAL___alignof = 149;
int LITERAL___real = 150;
int LITERAL___imag = 151;
int LITERAL___extension__ = 152;
int IntSuffix = 153;
int NumberSuffix = 154;
int IDMEAT = 155;
int WideCharLiteral = 156;
int WideStringLiteral = 157;
}
--- NEW FILE: GnuCLexerTokenTypes.txt ---
// $ANTLR 2.7.6 (2005-12-22): expandedGnuCParser.g -> GnuCLexerTokenTypes.txt$
GnuCLexer // output token vocab name
LITERAL_typedef="typedef"=4
PREPROC_DIRECTIVE("a line directive")=5
LITERAL_asm="asm"=6
LITERAL_volatile="volatile"=7
LCURLY=8
RCURLY=9
SEMI=10
LITERAL_struct="struct"=11
LITERAL_union="union"=12
LITERAL_enum="enum"=13
LITERAL_auto="auto"=14
LITERAL_register="register"=15
LITERAL_extern="extern"=16
LITERAL_static="static"=17
LITERAL_const="const"=18
LITERAL_void="void"=19
LITERAL_char="char"=20
LITERAL_short="short"=21
LITERAL_int="int"=22
LITERAL_long="long"=23
LITERAL_float="float"=24
LITERAL_double="double"=25
LITERAL_signed="signed"=26
LITERAL___builtin_va_list="__builtin_va_list"=27
LITERAL_unsigned="unsigned"=28
ID=29
COMMA=30
COLON=31
ASSIGN=32
STAR=33
LITERAL___restrict="__restrict"=34
LPAREN=35
RPAREN=36
LBRACKET=37
RBRACKET=38
VARARGS=39
LITERAL_while="while"=40
LITERAL_do="do"=41
LITERAL_for="for"=42
LITERAL_goto="goto"=43
LITERAL_continue="continue"=44
LITERAL_break="break"=45
LITERAL_return="return"=46
LITERAL_case="case"=47
LITERAL_default="default"=48
LITERAL_if="if"=49
LITERAL_else="else"=50
LITERAL_switch="switch"=51
DIV_ASSIGN=52
PLUS_ASSIGN=53
MINUS_ASSIGN=54
STAR_ASSIGN=55
MOD_ASSIGN=56
RSHIFT_ASSIGN=57
LSHIFT_ASSIGN=58
BAND_ASSIGN=59
BOR_ASSIGN=60
BXOR_ASSIGN=61
QUESTION=62
LOR=63
LAND=64
BOR=65
BXOR=66
BAND=67
EQUAL=68
NOT_EQUAL=69
LT=70
LTE=71
GT=72
GTE=73
LSHIFT=74
RSHIFT=75
PLUS=76
MINUS=77
DIV=78
MOD=79
INC=80
DEC=81
LITERAL_sizeof="sizeof"=82
BNOT=83
LNOT=84
PTR=85
DOT=86
CharLiteral=87
StringLiteral=88
IntOctalConst=89
LongOctalConst=90
UnsignedOctalConst=91
IntIntConst=92
LongIntConst=93
UnsignedIntConst=94
IntHexConst=95
LongHexConst=96
UnsignedHexConst=97
FloatDoubleConst=98
DoubleDoubleConst=99
LongDoubleConst=100
NTypedefName=101
NInitDecl=102
NDeclarator=103
NStructDeclarator=104
NDeclaration=105
NCast=106
NPointerGroup=107
NExpressionGroup=108
NFunctionCallArgs=109
NNonemptyAbstractDeclarator=110
NInitializer=111
NStatementExpr=112
NEmptyExpression=113
NParameterTypeList=114
NFunctionDef=115
NCompoundStatement=116
NParameterDeclaration=117
NCommaExpr=118
NUnaryExpr=119
NLabel=120
NPostfixExpr=121
NRangeExpr=122
NStringSeq=123
NInitializerElementLabel=124
NLcurlyInitializer=125
NAsmAttribute=126
NGnuAsmExpr=127
NTypeMissing=128
Vocabulary=129
Whitespace=130
Comment=131
CPPComment=132
Space=133
LineDirective=134
BadStringLiteral=135
Escape=136
Digit=137
LongSuffix=138
UnsignedSuffix=139
FloatSuffix=140
Exponent=141
Number=142
LITERAL___label__="__label__"=143
LITERAL_inline="inline"=144
LITERAL___inline="__inline"=145
LITERAL_typeof="typeof"=146
LITERAL___complex="__complex"=147
LITERAL___attribute="__attribute"=148
LITERAL___alignof="__alignof"=149
LITERAL___real="__real"=150
LITERAL___imag="__imag"=151
LITERAL___extension__="__extension__"=152
IntSuffix=153
NumberSuffix=154
IDMEAT=155
WideCharLiteral=156
WideStringLiteral=157
--- NEW FILE: GnuCParser.g ---
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Non, Inc. 1998 -- All Rights Reserved
PROJECT: C Compiler
MODULE: GnuCParser
FILE: GnuCParser.g
AUTHOR: Monty Zukowski (jamz at cdsnet.net) April 28, 1998
DESCRIPTION:
This is a grammar for the GNU C compiler. It is a
grammar subclass of StdCParser, overriding only those
rules which are different from Standard C.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
{
import java.io.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
}
class GnuCParser extends StdCParser;
options
{
k = 2;
exportVocab = GNUC;
buildAST = true;
ASTLabelType = "TNode";
// Copied following options from java grammar.
codeGenMakeSwitchThreshold = 2;
codeGenBitsetTestThreshold = 3;
}
{
// Suppport C++-style single-line comments?
public static boolean CPPComments = true;
public int j;
// access to symbol table
public CSymbolTable symbolTable = new CSymbolTable();
// source for names to unnamed scopes
protected int unnamedScopeCounter = 0;
public boolean isTypedefName(String name) {
boolean returnValue = false;
TNode node = symbolTable.lookupNameInCurrentScope(name);
for (; node != null; node = (TNode) node.getNextSibling() ) {
if(node.getType() == LITERAL_typedef) {
returnValue = true;
break;
}
}
return returnValue;
}
public String getAScopeName() {
return "" + (unnamedScopeCounter++);
}
public void pushScope(String scopeName) {
symbolTable.pushScope(scopeName);
}
public void popScope() {
symbolTable.popScope();
}
int traceDepth = 0;
public void reportError(RecognitionException ex) {
try {
System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]);
ex.printStackTrace(System.err);
}
catch (TokenStreamException e) {
System.err.println("ANTLR Parsing Error: "+ex);
ex.printStackTrace(System.err);
}
}
public void reportError(String s) {
System.err.println("ANTLR Parsing Error from String: " + s);
}
public void reportWarning(String s) {
System.err.println("ANTLR Parsing Warning from String: " + s);
}
public void match(int t) throws MismatchedTokenException {
boolean debugging = false;
if ( debugging ) {
for (int x=0; x<traceDepth; x++) System.out.print(" ");
try {
System.out.println("Match("+tokenNames[t]+") with LA(1)="+
tokenNames[LA(1)] + ((inputState.guessing>0)?" [inputState.guessing "+ inputState.guessing + "]":""));
}
catch (TokenStreamException e) {
System.out.println("Match("+tokenNames[t]+") " + ((inputState.guessing>0)?" [inputState.guessing "+ inputState.guessing + "]":""));
}
}
try {
if ( LA(1)!=t ) {
if ( debugging ){
for (int x=0; x<traceDepth; x++) System.out.print(" ");
System.out.println("token mismatch: "+tokenNames[LA(1)]
+ "!="+tokenNames[t]);
}
throw new MismatchedTokenException(tokenNames, LT(1), t, false, getFilename());
} else {
// mark token as consumed -- fetch next token deferred until LA/LT
consume();
}
}
catch (TokenStreamException e) {
}
}
public void traceIn(String rname) {
traceDepth += 1;
for (int x=0; x<traceDepth; x++) System.out.print(" ");
try {
System.out.println("> "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()]
+ ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]");
}
catch (TokenStreamException e) {
}
}
public void traceOut(String rname) {
for (int x=0; x<traceDepth; x++) System.out.print(" ");
try {
System.out.println("< "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()]
+ ") "+LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]");
}
catch (TokenStreamException e) {
}
traceDepth -= 1;
}
}
translationUnit
: ( externalList )? /* Empty source files are allowed. */
;
asm_expr
: "asm"^
("volatile")? LCURLY expr RCURLY ( SEMI )+
;
idList
: ID ( options{warnWhenFollowAmbig=false;}: COMMA ID )*
;
externalDef
: ( "typedef" | declaration )=> declaration
| ( functionPrefix )=> functionDef
| typelessDeclaration
| asm_expr
| PREPROC_DIRECTIVE
| SEMI
;
/* these two are here because GCC allows "cat = 13;" as a valid program! */
functionPrefix
{ String declName; }
: ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers
| //epsilon
)
(PREPROC_DIRECTIVE)*
declName = d:declarator[true]
( declaration )* (VARARGS)? ( SEMI )*
LCURLY
;
functionDef
{ String declName; }
: ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers
| //epsilon
)
(PREPROC_DIRECTIVE)*
declName = d:declarator[true]
{
AST d2, ds2;
d2 = astFactory.dupList(#d);
ds2 = astFactory.dupList(#ds);
symbolTable.add(declName, #(null, ds2, d2));
pushScope(declName);
}
( declaration )* (VARARGS)? ( SEMI! )*
{ popScope(); }
compoundStatement[declName]
{ ## = #( #[NFunctionDef], ## );}
;
typelessDeclaration
{ AST typeMissing = #[NTypeMissing]; }
: initDeclList[typeMissing] SEMI { ## = #( #[NTypeMissing], ##); }
;
initializer
: ( ( ( (initializerElementLabel)=> initializerElementLabel )?
( assignExpr | lcurlyInitializer ) { ## = #( #[NInitializer], ## ); }
)
| lcurlyInitializer
)
;
// GCC allows more specific initializers
initializerElementLabel
: ( ( LBRACKET ((constExpr VARARGS)=> rangeExpr | constExpr) RBRACKET (ASSIGN)? )
| ID COLON
| DOT ID ASSIGN
)
{ ## = #( #[NInitializerElementLabel], ##) ; }
;
// GCC allows empty initializer lists
lcurlyInitializer
:
LCURLY^ (initializerList ( COMMA! )? )? RCURLY
{ ##.setType( NLcurlyInitializer ); }
;
initializerList
: initializer ( options{warnWhenFollowAmbig=false;}:COMMA! initializer )*
;
declarator[boolean isFunctionDefinition] returns [String declName]
{ declName = ""; }
:
( pointerGroup )?
("__restrict")?
( attributeDecl )*
(id:ID { declName = id.getText(); }
| LPAREN declName = declarator[false] RPAREN
)?
( declaratorParamaterList[isFunctionDefinition, declName]
| LBRACKET (PREPROC_DIRECTIVE)* ( expr )? (PREPROC_DIRECTIVE)* RBRACKET
)*
{ ## = #( #[NDeclarator], ## ); }
;
declaratorParamaterList[boolean isFunctionDefinition, String declName]
:
LPAREN^ (PREPROC_DIRECTIVE)*
{
if (isFunctionDefinition) {
pushScope(declName);
}
else {
pushScope("!"+declName);
}
}
(
(declSpecifiers)=> parameterTypeList
| (idList)?
)
{
popScope();
}
( COMMA! )?
RPAREN
(PREPROC_DIRECTIVE)*
{ ##.setType(NParameterTypeList); }
;
parameterTypeList
: parameterDeclaration
( options {
warnWhenFollowAmbig = false;
} :
( COMMA | SEMI )
(PREPROC_DIRECTIVE)* parameterDeclaration
)*
( ( COMMA | SEMI )
VARARGS
)?
;
declarationList
:
( options { // this loop properly aborts when
// it finds a non-typedefName ID MBZ
warnWhenFollowAmbig = false;
} :
localLabelDeclaration
| ( declarationPredictor )=> declaration (PREPROC_DIRECTIVE)*
)+
;
localLabelDeclaration
: ( //GNU note: any __label__ declarations must come before regular declarations.
"__label__"^ ID (options{warnWhenFollowAmbig=false;}: COMMA! ID)* ( COMMA! )? ( SEMI! )+
)
;
declaration
{ AST ds1 = null; }
: ds:declSpecifiers { ds1 = astFactory.dupList(#ds); }
(
initDeclList[ds1]
)?
( SEMI )+
{ ## = #( #[NDeclaration], ##); }
;
functionStorageClassSpecifier
: "extern"
| "static"
| "inline"
| "__inline"
;
typeSpecifier [int specCount] returns [int retSpecCount]
{ retSpecCount = specCount + 1; }
:
( "void"
| "char"
| "short"
| "int"
| "long"
| "float"
| "double"
| "signed"
| "__builtin_va_list"
| "unsigned"
| structOrUnionSpecifier ( options{warnWhenFollowAmbig=false;}: attributeDecl )*
| enumSpecifier
| { specCount==0 }? typedefName
| "typeof"^ LPAREN
( ( typeName )=> typeName
| expr
)
RPAREN
| "__complex"
)
;
structOrUnionSpecifier
{ String scopeName; }
: sou:structOrUnion!
( ( ID LCURLY )=> i:ID l:LCURLY
{
scopeName = #sou.getText() + " " + #i.getText();
#l.setText(scopeName);
pushScope(scopeName);
}
( structDeclarationList )?
{ popScope();}
RCURLY
(PREPROC_DIRECTIVE)*
| l1:LCURLY
{
scopeName = getAScopeName();
#l1.setText(scopeName);
pushScope(scopeName);
}
( structDeclarationList )?
{ popScope(); }
RCURLY (PREPROC_DIRECTIVE)*
| ID
)
{
## = #( #sou, ## );
}
;
structDeclaration
: specifierQualifierList structDeclaratorList ( COMMA! )? ( SEMI! )+
;
structDeclaratorList
: (PREPROC_DIRECTIVE)*
structDeclarator ( options{warnWhenFollowAmbig=false;}: COMMA! (PREPROC_DIRECTIVE)* structDeclarator (PREPROC_DIRECTIVE)* )*
;
structDeclarator
: ( declarator[false] )?
( COLON constExpr )?
( attributeDecl )*
{ ## = #( #[NStructDeclarator], ##); }
;
enumSpecifier
: "enum"^
( ( ID LCURLY )=> i:ID LCURLY (PREPROC_DIRECTIVE)* enumList[i.getText()] (PREPROC_DIRECTIVE)* RCURLY
| LCURLY (PREPROC_DIRECTIVE)* enumList["anonymous"] (PREPROC_DIRECTIVE)* RCURLY
| ID
)
( attributeDecl )*
;
enumList[String enumName]
: enumerator[enumName] ( options{warnWhenFollowAmbig=false;}: COMMA! enumerator[enumName] )* ( COMMA! )?
;
initDeclList[AST declarationSpecifiers]
: initDecl[declarationSpecifiers]
( options{warnWhenFollowAmbig=false;}: COMMA! initDecl[declarationSpecifiers] )*
( COMMA! )?
;
initDecl[AST declarationSpecifiers]
{ String declName = ""; }
: declName = d:declarator[false]
{ AST ds1, d1;
ds1 = astFactory.dupList(declarationSpecifiers);
d1 = astFactory.dupList(#d);
symbolTable.add(declName, #(null, ds1, d1) );
}
( attributeDecl )*
( ASSIGN initializer
| COLON expr
)?
{ ## = #( #[NInitDecl], ## ); }
;
attributeDecl
: "__attribute"^ LPAREN LPAREN attributeList RPAREN RPAREN
| "asm"^ LPAREN stringConst RPAREN { ##.setType( NAsmAttribute ); }
;
attributeList
: attribute ( options{warnWhenFollowAmbig=false;}: COMMA attribute)* ( COMMA )?
;
attribute
: ( ~(LPAREN | RPAREN | COMMA)
| LPAREN attributeList RPAREN
)*
;
compoundStatement[String scopeName]
:
LCURLY^ (PREPROC_DIRECTIVE)*
{
pushScope(scopeName);
}
( //this ambiguity is ok, declarationList and nestedFunctionDef end properly
options {
warnWhenFollowAmbig = false;
} :
( "typedef" | "__label__" | declaration )=> declarationList
| (nestedFunctionDef)=> nestedFunctionDef
)*
( statementList )?
{ popScope(); }
RCURLY
{ ##.setType( NCompoundStatement ); ##.setAttribute( "scopeName", scopeName ); }
;
nestedFunctionDef
{ String declName; }
: ( "auto" )? //only for nested functions
( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers
)?
declName = d:declarator[false]
{
AST d2, ds2;
d2 = astFactory.dupList(#d);
ds2 = astFactory.dupList(#ds);
symbolTable.add(declName, #(null, ds2, d2));
pushScope(declName);
}
( declaration )*
{ popScope(); }
compoundStatement[declName]
{ ## = #( #[NFunctionDef], ## );}
;
statement
: SEMI // Empty statements
| compoundStatement[getAScopeName()] // Group of statements
| PREPROC_DIRECTIVE
| expr SEMI! { ## = #( #[NStatementExpr], ## );} // Expressions
// Iteration statements:
| "while"^ LPAREN! expr RPAREN! statement
| "do"^ statement (PREPROC_DIRECTIVE)* "while"! LPAREN! expr RPAREN! SEMI!
|! forNode:"for"
LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN
s:statement
{
if ( #e1 == null) { #e1 = #[ NEmptyExpression ]; }
if ( #e2 == null) { #e2 = #[ NEmptyExpression ]; }
if ( #e3 == null) { #e3 = #[ NEmptyExpression ]; }
## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s );
}
// Jump statements:
| "goto"^ expr SEMI!
| "continue" SEMI!
| "break" SEMI!
| "return"^ ( expr )? SEMI!
| ID COLON! (options {warnWhenFollowAmbig=false;}: statement)? { ## = #( #[NLabel], ## ); }
// GNU allows range expressions in case statements
| "case"^ ((constExpr VARARGS)=> rangeExpr | constExpr) COLON! ( options{warnWhenFollowAmbig=false;}:statement )?
| "default"^ COLON! ( options{warnWhenFollowAmbig=false;}: statement )?
// Selection statements:
| "if"^
LPAREN! expr RPAREN! (PREPROC_DIRECTIVE)* statement
( //standard if-else ambiguity
options {
warnWhenFollowAmbig = false;
} :
"else" (PREPROC_DIRECTIVE)* statement )?
| "switch"^ LPAREN! expr RPAREN! statement
;
conditionalExpr
: logicalOrExpr
( QUESTION^ (expr)? COLON conditionalExpr )?
;
rangeExpr //used in initializers only
: constExpr VARARGS constExpr
{ ## = #(#[NRangeExpr], ##); }
;
castExpr
: ( LPAREN typeName RPAREN )=>
LPAREN^ typeName RPAREN
( castExpr | lcurlyInitializer )
{ ##.setType(NCast); }
| unaryExpr
;
nonemptyAbstractDeclarator
: (
pointerGroup
( (LPAREN
( nonemptyAbstractDeclarator
| parameterTypeList
)?
( COMMA! )?
RPAREN)
| (LBRACKET (expr)? RBRACKET)
)*
| ( (LPAREN
( nonemptyAbstractDeclarator
| parameterTypeList
)?
( COMMA! )?
RPAREN)
| (LBRACKET (expr)? RBRACKET)
)+
)
{ ## = #( #[NNonemptyAbstractDeclarator], ## ); }
;
unaryExpr
: postfixExpr
| INC^ castExpr
| DEC^ castExpr
| u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); }
| "sizeof"^
( ( LPAREN typeName )=> LPAREN typeName RPAREN
| unaryExpr
)
| "__alignof"^
( ( LPAREN typeName )=> LPAREN typeName RPAREN
| unaryExpr
)
| gnuAsmExpr
;
unaryOperator
: BAND
| STAR
| PLUS
| MINUS
| BNOT //also stands for complex conjugation
| LNOT
| LAND //for label dereference (&&label)
| "__real"
| "__imag"
| PREPROC_DIRECTIVE
;
gnuAsmExpr
: "asm"^ ("volatile")?
LPAREN stringConst
( options { warnWhenFollowAmbig = false; }:
COLON (strOptExprPair ( COMMA strOptExprPair)* )?
( options { warnWhenFollowAmbig = false; }:
COLON (strOptExprPair ( COMMA strOptExprPair)* )?
)?
)?
( COLON stringConst ( COMMA stringConst)* )?
RPAREN
{ ##.setType(NGnuAsmExpr); }
;
//GCC requires the PARENs
strOptExprPair
: stringConst ( LPAREN expr RPAREN )?
;
primaryExpr
: ID
| Number
| charConst
| stringConst
// JTC:
// ID should catch the enumerator
// leaving it in gives ambiguous err
// | enumerator
| (LPAREN LCURLY) => LPAREN^ compoundStatement[getAScopeName()] RPAREN
| LPAREN^ expr RPAREN { ##.setType(NExpressionGroup); }
;
{
import CToken;
import java.io.*;
import LineObject;
import antlr.*;
}
class GnuCLexer extends StdCLexer;
options
{
k = 3;
importVocab = GNUC;
testLiterals = false;
}
tokens {
LITERAL___extension__ = "__extension__";
}
{
public void initialize(String src)
{
setOriginalSource(src);
initialize();
}
public void initialize()
{
literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof));
literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm));
literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm));
literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute));
literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex));
literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const));
literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const));
literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag));
literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline));
literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline));
literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real));
literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed));
literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed));
literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof));
literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof));
literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile));
literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile));
}
LineObject lineObject = new LineObject();
String originalSource = "";
PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel();
int tokenNumber = 0;
boolean countingTokens = true;
int deferredLineCount = 0;
public void setCountingTokens(boolean ct)
{
countingTokens = ct;
if ( countingTokens ) {
tokenNumber = 0;
}
else {
tokenNumber = 1;
}
}
public void setOriginalSource(String src)
{
originalSource = src;
lineObject.setSource(src);
}
public void setSource(String src)
{
lineObject.setSource(src);
}
public PreprocessorInfoChannel getPreprocessorInfoChannel()
{
return preprocessorInfoChannel;
}
public void setPreprocessingDirective(String pre)
{
preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) );
}
protected Token makeToken(int t)
{
if ( t != Token.SKIP && countingTokens) {
tokenNumber++;
}
CToken tok = (CToken) super.makeToken(t);
tok.setLine(lineObject.line);
tok.setSource(lineObject.source);
tok.setTokenNumber(tokenNumber);
lineObject.line += deferredLineCount;
deferredLineCount = 0;
return tok;
}
public void deferredNewline() {
deferredLineCount++;
}
public void newline() {
lineObject.newline();
}
}
Whitespace
: ( ( ' ' | '\t' | '\014')
| "\r\n" { newline(); }
| ( '\n' | '\r' ) { newline(); }
) { _ttype = Token.SKIP; }
;
protected
Escape
: '\\'
( options{warnWhenFollowAmbig=false;}:
~('0'..'7' | 'x')
| ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit )*
| ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )*
| 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+
)
;
protected IntSuffix
: 'L'
| 'l'
| 'U'
| 'u'
| 'I'
| 'i'
| 'J'
| 'j'
;
protected NumberSuffix
:
IntSuffix
| 'F'
| 'f'
;
Number
: ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+
( '.' ( Digit )* ( Exponent )?
| Exponent
)
( NumberSuffix
)*
| ( "..." )=> "..." { _ttype = VARARGS; }
| '.' { _ttype = DOT; }
( ( Digit )+ ( Exponent )?
{ _ttype = Number; }
( NumberSuffix
)*
)?
| '0' ( '0'..'7' )*
( NumberSuffix
)*
| '1'..'9' ( Digit )*
( NumberSuffix
)*
| '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+
( IntSuffix
)*
;
IDMEAT
:
i:ID {
if ( i.getType() == LITERAL___extension__ ) {
$setType(Token.SKIP);
}
else {
$setType(i.getType());
}
}
;
protected ID
options
{
testLiterals = true;
}
: ( 'a'..'z' | 'A'..'Z' | '_' | '$')
( 'a'..'z' | 'A'..'Z' | '_' | '$' | '0'..'9' )*
;
WideCharLiteral
:
'L' CharLiteral
{ $setType(CharLiteral); }
;
WideStringLiteral
:
'L' StringLiteral
{ $setType(StringLiteral); }
;
StringLiteral
:
'"'
( ('\\' ~('\n'))=> Escape
| ( '\r' { newline(); }
| '\n' {
newline();
}
| '\\' '\n' {
newline();
}
)
| ~( '"' | '\r' | '\n' | '\\' )
)*
'"'
;
--- NEW FILE: GnuCParser.java ---
// $ANTLR 2.7.6 (2005-12-22): "expandedGnuCParser.g" -> "GnuCParser.java"$
import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;
import antlr.collections.AST;
import java.util.Hashtable;
import antlr.ASTFactory;
import antlr.ASTPair;
[...8122 lines suppressed...]
return data;
}
public static final BitSet _tokenSet_94 = new BitSet(mk_tokenSet_94());
private static final long[] mk_tokenSet_95() {
long[] data = { -4502698757978528L, 4095L, 1048576L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_95 = new BitSet(mk_tokenSet_95());
private static final long[] mk_tokenSet_96() {
long[] data = { 8589934592L, 49152L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_96 = new BitSet(mk_tokenSet_96());
private static final long[] mk_tokenSet_97() {
long[] data = { -4502698757978528L, 16383L, 1048576L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_97 = new BitSet(mk_tokenSet_97());
}
--- NEW FILE: GnuCParser.smap ---
SMAP
GnuCParser.java
G
*S G
*F
+ 0 expandedGnuCParser.g
expandedGnuCParser.g
*L
19:30
20:31
21:32
22:33
23:34
25:36
26:37
28:39
29:40
30:41
31:42
[...5964 lines suppressed...]
848:7469
848:7470
848:7471
849:7463
849:7475
849:7476
849:7477
849:7478
849:7479
849:7480
850:7472
850:7484
850:7485
850:7486
850:7487
850:7488
850:7489
851:7481
852:7490
*E
--- NEW FILE: GnuCTreeParser.g ---
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Non, Inc. 1998 -- All Rights Reserved
PROJECT: C Compiler
MODULE: GnuCTreeParser
FILE: GnuCTreeParser.g
AUTHOR: Monty Zukowski (jamz at cdsnet.net) April 28, 1998
DESCRIPTION:
This tree grammar is for a Gnu C AST. No actions in it,
subclass to do something useful.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
{
import java.io.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
}
class GnuCTreeParser extends TreeParser;
options
{
importVocab = GNUC;
buildAST = false;
ASTLabelType = "TNode";
// Copied following options from java grammar.
codeGenMakeSwitchThreshold = 2;
codeGenBitsetTestThreshold = 3;
}
{
int traceDepth = 0;
public void reportError(RecognitionException ex) {
if ( ex != null) {
System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex );
ex.printStackTrace(System.err);
}
}
public void reportError(NoViableAltException ex) {
System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString());
TNode.printTree( ex.node );
ex.printStackTrace(System.err);
}
public void reportError(MismatchedTokenException ex) {
if ( ex != null) {
TNode.printTree( ex.node );
System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex );
ex.printStackTrace(System.err);
}
}
public void reportError(String s) {
System.err.println("ANTLR Error from String: " + s);
}
public void reportWarning(String s) {
System.err.println("ANTLR Warning from String: " + s);
}
protected void match(AST t, int ttype) throws MismatchedTokenException {
//System.out.println("match("+ttype+"); cursor is "+t);
super.match(t, ttype);
}
public void match(AST t, BitSet b) throws MismatchedTokenException {
//System.out.println("match("+b+"); cursor is "+t);
super.match(t, b);
}
protected void matchNot(AST t, int ttype) throws MismatchedTokenException {
//System.out.println("matchNot("+ttype+"); cursor is "+t);
super.matchNot(t, ttype);
}
public void traceIn(String rname, AST t) {
traceDepth += 1;
for (int x=0; x<traceDepth; x++) System.out.print(" ");
super.traceIn(rname, t);
}
public void traceOut(String rname, AST t) {
for (int x=0; x<traceDepth; x++) System.out.print(" ");
super.traceOut(rname, t);
traceDepth -= 1;
}
}
translationUnit options {
defaultErrorHandler=false;
}
: ( externalList )?
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
externalList
: ( externalDef )+
;
externalDef
: declaration
| functionDef
| asm_expr
| PREPROC_DIRECTIVE
| SEMI
| typelessDeclaration
;
typelessDeclaration
: #(NTypeMissing initDeclList SEMI)
;
asm_expr
: #( "asm" ( "volatile" )? LCURLY expr RCURLY ( SEMI )+ )
;
declaration
: #( NDeclaration
declSpecifiers
(
initDeclList
)?
( SEMI )+
)
;
declSpecifiers
: ( storageClassSpecifier
| typeQualifier
| typeSpecifier
)+
;
storageClassSpecifier
: "auto"
| "register"
| "typedef"
| functionStorageClassSpecifier
;
functionStorageClassSpecifier
: "extern"
| "static"
| "inline"
| "__inline"
;
typeQualifier
: "const"
| "volatile"
;
typeSpecifier
: "void"
| "char"
| "short"
| "int"
| "long"
| "float"
| "double"
| "signed"
| "__builtin_va_list"
| "unsigned"
| structSpecifier ( attributeDecl )*
| unionSpecifier ( attributeDecl )*
| enumSpecifier
| typedefName
| #("typeof" LPAREN
( (typeName )=> typeName
| expr
)
RPAREN
)
| "__complex"
;
typedefName
: #(NTypedefName ID)
;
structSpecifier
: #( "struct" structOrUnionBody )
;
unionSpecifier
: #( "union" structOrUnionBody )
;
structOrUnionBody
: ( (ID LCURLY) => ID LCURLY
( structDeclarationList )?
RCURLY (PREPROC_DIRECTIVE)*
| LCURLY
( structDeclarationList )?
RCURLY
(PREPROC_DIRECTIVE)*
| ID
)
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
structDeclarationList
: (PREPROC_DIRECTIVE)* ( structDeclaration (PREPROC_DIRECTIVE)* )+
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
structDeclaration
: specifierQualifierList structDeclaratorList
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
specifierQualifierList
: (
typeSpecifier
| typeQualifier
)+
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
structDeclaratorList
: ( structDeclarator )+
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
structDeclarator
:
#( NStructDeclarator
( declarator )?
( COLON expr )?
( attributeDecl )*
)
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
enumSpecifier
: #( "enum"
( ID )?
( LCURLY (PREPROC_DIRECTIVE)* enumList (PREPROC_DIRECTIVE)* RCURLY )?
( attributeDecl )*
)
;
enumList
: ( enumerator )+
;
enumerator
: ID ( ASSIGN expr )?
;
attributeDecl:
#( "__attribute" (.)* )
| #( NAsmAttribute LPAREN expr RPAREN )
;
initDeclList
: ( initDecl )+
;
initDecl
{ String declName = ""; }
: #( NInitDecl
declarator
( attributeDecl )*
( ASSIGN initializer
| COLON expr
)?
)
;
pointerGroup
: #( NPointerGroup ( STAR ( typeQualifier )* )+ )
;
idList
: ID ( COMMA ID )*
;
initializer
: #( NInitializer (initializerElementLabel)? expr )
| lcurlyInitializer
;
initializerElementLabel
: #( NInitializerElementLabel
(
( LBRACKET expr RBRACKET (ASSIGN)? )
| ID COLON
| DOT ID ASSIGN
)
)
;
lcurlyInitializer
: #( NLcurlyInitializer
initializerList
RCURLY
)
;
initializerList
: ( initializer )*
;
declarator
: #( NDeclarator
( pointerGroup )?
("__restrict")?
( attributeDecl )*
( id:ID
| LPAREN declarator RPAREN
)?
( #( NParameterTypeList
(
parameterTypeList
| (idList)?
)
RPAREN
(PREPROC_DIRECTIVE)*
)
| LBRACKET (PREPROC_DIRECTIVE)* ( expr )? (PREPROC_DIRECTIVE)* RBRACKET
)*
)
;
parameterTypeList
: ( (PREPROC_DIRECTIVE)* parameterDeclaration ( COMMA | SEMI )? )+ ( VARARGS )?
;
parameterDeclaration
: #( NParameterDeclaration
declSpecifiers
(declarator | nonemptyAbstractDeclarator)?
)
;
functionDef
: #( NFunctionDef
( functionDeclSpecifiers)?
(PREPROC_DIRECTIVE)*
declarator
(declaration | VARARGS)*
compoundStatement
)
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
functionDeclSpecifiers
:
( functionStorageClassSpecifier
| typeQualifier
| typeSpecifier
)+
;
declarationList
:
( //ANTLR doesn't know that declarationList properly eats all the declarations
//so it warns about the ambiguity
options {
warnWhenFollowAmbig = false;
} :
localLabelDecl
| declaration (PREPROC_DIRECTIVE)*
)+
;
localLabelDecl
: #("__label__" (ID)+ )
;
compoundStatement
:
#( NCompoundStatement (PREPROC_DIRECTIVE)*
( declarationList
| functionDef
)*
( statementList )?
RCURLY
)
;
statementList
: ( statement )+
;
statement
: statementBody
;
statementBody
: SEMI // Empty statements
| compoundStatement // Group of statements
| PREPROC_DIRECTIVE
| #(NStatementExpr expr) // Expressions
// Iteration statements:
| #( "while" expr statement )
| #( "do" statement (PREPROC_DIRECTIVE)* expr )
| #( "for"
expr expr expr
statement
)
// Jump statements:
| #( "goto" expr )
| "continue"
| "break"
| #( "return" ( expr )? )
// Labeled statements:
| #( NLabel ID (statement)? )
| #( "case" expr (statement)? )
| #( "default" (statement)? )
// Selection statements:
| #( "if"
expr (PREPROC_DIRECTIVE)* statement
( "else" (PREPROC_DIRECTIVE)* statement )?
)
| #( "switch" expr statement )
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
expr
: assignExpr
| conditionalExpr
| logicalOrExpr
| logicalAndExpr
| inclusiveOrExpr
| exclusiveOrExpr
| bitAndExpr
| equalityExpr
| relationalExpr
| shiftExpr
| additiveExpr
| multExpr
| castExpr
| unaryExpr
| postfixExpr
| primaryExpr
| commaExpr
| emptyExpr
| compoundStatementExpr
| initializer
| rangeExpr
| gnuAsmExpr
;
commaExpr
: #(NCommaExpr expr expr)
;
emptyExpr
: NEmptyExpression
;
compoundStatementExpr
: #(LPAREN compoundStatement RPAREN)
;
rangeExpr
: #(NRangeExpr expr VARARGS expr)
;
gnuAsmExpr
: #(NGnuAsmExpr
("volatile")?
LPAREN stringConst
( options { warnWhenFollowAmbig = false; }:
COLON (strOptExprPair ( COMMA strOptExprPair)* )?
( options { warnWhenFollowAmbig = false; }:
COLON (strOptExprPair ( COMMA strOptExprPair)* )?
)?
)?
( COLON stringConst ( COMMA stringConst)* )?
RPAREN
)
;
strOptExprPair
: stringConst ( LPAREN expr RPAREN )?
;
assignExpr
: #( ASSIGN expr expr)
| #( DIV_ASSIGN expr expr)
| #( PLUS_ASSIGN expr expr)
| #( MINUS_ASSIGN expr expr)
| #( STAR_ASSIGN expr expr)
| #( MOD_ASSIGN expr expr)
| #( RSHIFT_ASSIGN expr expr)
| #( LSHIFT_ASSIGN expr expr)
| #( BAND_ASSIGN expr expr)
| #( BOR_ASSIGN expr expr)
| #( BXOR_ASSIGN expr expr)
;
conditionalExpr
: #( QUESTION expr (expr)? COLON expr )
;
logicalOrExpr
: #( LOR expr expr)
;
logicalAndExpr
: #( LAND expr expr )
;
inclusiveOrExpr
: #( BOR expr expr )
;
exclusiveOrExpr
: #( BXOR expr expr )
;
bitAndExpr
: #( BAND expr expr )
;
equalityExpr
: #( EQUAL expr expr)
| #( NOT_EQUAL expr expr)
;
relationalExpr
: #( LT expr expr)
| #( LTE expr expr)
| #( GT expr expr)
| #( GTE expr expr)
;
shiftExpr
: #( LSHIFT expr expr)
| #( RSHIFT expr expr)
;
additiveExpr
: #( PLUS expr expr)
| #( MINUS expr expr)
;
multExpr
: #( STAR expr expr)
| #( DIV expr expr)
| #( MOD expr expr)
;
castExpr
: #( NCast typeName RPAREN expr )
;
typeName
: specifierQualifierList (nonemptyAbstractDeclarator)?
;
nonemptyAbstractDeclarator
: #( NNonemptyAbstractDeclarator
( pointerGroup
( (LPAREN
( nonemptyAbstractDeclarator
| parameterTypeList
)?
RPAREN)
| (LBRACKET (expr)? RBRACKET)
)*
| ( (LPAREN
( nonemptyAbstractDeclarator
| parameterTypeList
)?
RPAREN)
| (LBRACKET (expr)? RBRACKET)
)+
)
)
;
unaryExpr
: #( INC expr )
| #( DEC expr )
| #( NUnaryExpr unaryOperator expr)
| #( "sizeof"
( ( LPAREN typeName )=> LPAREN typeName RPAREN
| expr
)
)
| #( "__alignof"
( ( LPAREN typeName )=> LPAREN typeName RPAREN
| expr
)
)
;
/*
exception
catch [RecognitionException ex]
{
reportError(ex);
System.out.println("PROBLEM TREE:\n"
+ _t.toStringList());
if (_t!=null) {_t = _t.getNextSibling();}
}
*/
unaryOperator
: BAND
| STAR
| PLUS
| MINUS
| BNOT
| LNOT
| LAND
| "__real"
| "__imag"
| PREPROC_DIRECTIVE
;
postfixExpr
: #( NPostfixExpr
primaryExpr
( PTR ID
| DOT ID
| #( NFunctionCallArgs (argExprList)? RPAREN )
| LBRACKET expr RBRACKET
| INC
| DEC
)+
)
;
primaryExpr
: ID
| Number
| charConst
| stringConst
// JTC:
// ID should catch the enumerator
// leaving it in gives ambiguous err
// | enumerator
| #( NExpressionGroup expr )
;
argExprList
: ( expr )+
;
protected
charConst
: CharLiteral
;
protected
stringConst
: #(NStringSeq (StringLiteral)+)
;
protected
intConst
: IntOctalConst
| LongOctalConst
| UnsignedOctalConst
| IntIntConst
| LongIntConst
| UnsignedIntConst
| IntHexConst
| LongHexConst
| UnsignedHexConst
;
protected
floatConst
: FloatDoubleConst
| DoubleDoubleConst
| LongDoubleConst
;
--- NEW FILE: GnuCTreeParser.java ---
// $ANTLR 2.7.6 (2005-12-22): "GnuCTreeParser.g" -> "GnuCTreeParser.java"$
import antlr.TreeParser;
import antlr.Token;
import antlr.collections.AST;
import antlr.RecognitionException;
import antlr.ANTLRException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.collections.impl.BitSet;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;
import java.io.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
[...5826 lines suppressed...]
return data;
}
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
private static final long[] mk_tokenSet_1() {
long[] data = { 536623232L, 137438953472L, 786432L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
private static final long[] mk_tokenSet_2() {
long[] data = { 3376600208901152L, 76842668642009088L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
private static final long[] mk_tokenSet_3() {
long[] data = { -4503551845859328L, -5853953837898399745L, 2113536L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
}
--- NEW FILE: GnuCTreeParser.smap ---
SMAP
GnuCTreeParser.java
G
*S G
*F
+ 0 GnuCTreeParser.g
GnuCTreeParser.g
*L
42:24
43:25
44:26
45:27
46:28
47:29
48:30
49:31
50:32
51:33
52:34
[...4487 lines suppressed...]
856:5683
856:5684
856:5685
856:5686
857:5650
857:5651
857:5652
857:5653
857:5654
858:5657
858:5658
858:5659
858:5660
858:5661
859:5664
859:5665
859:5666
859:5667
859:5668
*E
--- NEW FILE: GnuCTreeParserTokenTypes.java ---
// $ANTLR 2.7.6 (2005-12-22): "GnuCTreeParser.g" -> "GnuCTreeParser.java"$
public interface GnuCTreeParserTokenTypes {
int EOF = 1;
int NULL_TREE_LOOKAHEAD = 3;
int LITERAL_typedef = 4;
int PREPROC_DIRECTIVE = 5;
int LITERAL_asm = 6;
int LITERAL_volatile = 7;
int LCURLY = 8;
int RCURLY = 9;
int SEMI = 10;
int LITERAL_struct = 11;
int LITERAL_union = 12;
int LITERAL_enum = 13;
int LITERAL_auto = 14;
int LITERAL_register = 15;
int LITERAL_extern = 16;
int LITERAL_static = 17;
int LITERAL_const = 18;
int LITERAL_void = 19;
int LITERAL_char = 20;
int LITERAL_short = 21;
int LITERAL_int = 22;
int LITERAL_long = 23;
int LITERAL_float = 24;
int LITERAL_double = 25;
int LITERAL_signed = 26;
int LITERAL___builtin_va_list = 27;
int LITERAL_unsigned = 28;
int ID = 29;
int COMMA = 30;
int COLON = 31;
int ASSIGN = 32;
int STAR = 33;
int LITERAL___restrict = 34;
int LPAREN = 35;
int RPAREN = 36;
int LBRACKET = 37;
int RBRACKET = 38;
int VARARGS = 39;
int LITERAL_while = 40;
int LITERAL_do = 41;
int LITERAL_for = 42;
int LITERAL_goto = 43;
int LITERAL_continue = 44;
int LITERAL_break = 45;
int LITERAL_return = 46;
int LITERAL_case = 47;
int LITERAL_default = 48;
int LITERAL_if = 49;
int LITERAL_else = 50;
int LITERAL_switch = 51;
int DIV_ASSIGN = 52;
int PLUS_ASSIGN = 53;
int MINUS_ASSIGN = 54;
int STAR_ASSIGN = 55;
int MOD_ASSIGN = 56;
int RSHIFT_ASSIGN = 57;
int LSHIFT_ASSIGN = 58;
int BAND_ASSIGN = 59;
int BOR_ASSIGN = 60;
int BXOR_ASSIGN = 61;
int QUESTION = 62;
int LOR = 63;
int LAND = 64;
int BOR = 65;
int BXOR = 66;
int BAND = 67;
int EQUAL = 68;
int NOT_EQUAL = 69;
int LT = 70;
int LTE = 71;
int GT = 72;
int GTE = 73;
int LSHIFT = 74;
int RSHIFT = 75;
int PLUS = 76;
int MINUS = 77;
int DIV = 78;
int MOD = 79;
int INC = 80;
int DEC = 81;
int LITERAL_sizeof = 82;
int BNOT = 83;
int LNOT = 84;
int PTR = 85;
int DOT = 86;
int CharLiteral = 87;
int StringLiteral = 88;
int IntOctalConst = 89;
int LongOctalConst = 90;
int UnsignedOctalConst = 91;
int IntIntConst = 92;
int LongIntConst = 93;
int UnsignedIntConst = 94;
int IntHexConst = 95;
int LongHexConst = 96;
int UnsignedHexConst = 97;
int FloatDoubleConst = 98;
int DoubleDoubleConst = 99;
int LongDoubleConst = 100;
int NTypedefName = 101;
int NInitDecl = 102;
int NDeclarator = 103;
int NStructDeclarator = 104;
int NDeclaration = 105;
int NCast = 106;
int NPointerGroup = 107;
int NExpressionGroup = 108;
int NFunctionCallArgs = 109;
int NNonemptyAbstractDeclarator = 110;
int NInitializer = 111;
int NStatementExpr = 112;
int NEmptyExpression = 113;
int NParameterTypeList = 114;
int NFunctionDef = 115;
int NCompoundStatement = 116;
int NParameterDeclaration = 117;
int NCommaExpr = 118;
int NUnaryExpr = 119;
int NLabel = 120;
int NPostfixExpr = 121;
int NRangeExpr = 122;
int NStringSeq = 123;
int NInitializerElementLabel = 124;
int NLcurlyInitializer = 125;
int NAsmAttribute = 126;
int NGnuAsmExpr = 127;
int NTypeMissing = 128;
int Vocabulary = 129;
int Whitespace = 130;
int Comment = 131;
int CPPComment = 132;
int Space = 133;
int LineDirective = 134;
int BadStringLiteral = 135;
int Escape = 136;
int Digit = 137;
int LongSuffix = 138;
int UnsignedSuffix = 139;
int FloatSuffix = 140;
int Exponent = 141;
int Number = 142;
int LITERAL___label__ = 143;
int LITERAL_inline = 144;
int LITERAL___inline = 145;
int LITERAL_typeof = 146;
int LITERAL___complex = 147;
int LITERAL___attribute = 148;
int LITERAL___alignof = 149;
int LITERAL___real = 150;
int LITERAL___imag = 151;
}
--- NEW FILE: GnuCTreeParserTokenTypes.txt ---
// $ANTLR 2.7.6 (2005-12-22): GnuCTreeParser.g -> GnuCTreeParserTokenTypes.txt$
GnuCTreeParser // output token vocab name
LITERAL_typedef="typedef"=4
PREPROC_DIRECTIVE("a line directive")=5
LITERAL_asm="asm"=6
LITERAL_volatile="volatile"=7
LCURLY=8
RCURLY=9
SEMI=10
LITERAL_struct="struct"=11
LITERAL_union="union"=12
LITERAL_enum="enum"=13
LITERAL_auto="auto"=14
LITERAL_register="register"=15
LITERAL_extern="extern"=16
LITERAL_static="static"=17
LITERAL_const="const"=18
LITERAL_void="void"=19
LITERAL_char="char"=20
LITERAL_short="short"=21
LITERAL_int="int"=22
LITERAL_long="long"=23
LITERAL_float="float"=24
LITERAL_double="double"=25
LITERAL_signed="signed"=26
LITERAL___builtin_va_list="__builtin_va_list"=27
LITERAL_unsigned="unsigned"=28
ID=29
COMMA=30
COLON=31
ASSIGN=32
STAR=33
LITERAL___restrict="__restrict"=34
LPAREN=35
RPAREN=36
LBRACKET=37
RBRACKET=38
VARARGS=39
LITERAL_while="while"=40
LITERAL_do="do"=41
LITERAL_for="for"=42
LITERAL_goto="goto"=43
LITERAL_continue="continue"=44
LITERAL_break="break"=45
LITERAL_return="return"=46
LITERAL_case="case"=47
LITERAL_default="default"=48
LITERAL_if="if"=49
LITERAL_else="else"=50
LITERAL_switch="switch"=51
DIV_ASSIGN=52
PLUS_ASSIGN=53
MINUS_ASSIGN=54
STAR_ASSIGN=55
MOD_ASSIGN=56
RSHIFT_ASSIGN=57
LSHIFT_ASSIGN=58
BAND_ASSIGN=59
BOR_ASSIGN=60
BXOR_ASSIGN=61
QUESTION=62
LOR=63
LAND=64
BOR=65
BXOR=66
BAND=67
EQUAL=68
NOT_EQUAL=69
LT=70
LTE=71
GT=72
GTE=73
LSHIFT=74
RSHIFT=75
PLUS=76
MINUS=77
DIV=78
MOD=79
INC=80
DEC=81
LITERAL_sizeof="sizeof"=82
BNOT=83
LNOT=84
PTR=85
DOT=86
CharLiteral=87
StringLiteral=88
IntOctalConst=89
LongOctalConst=90
UnsignedOctalConst=91
IntIntConst=92
LongIntConst=93
UnsignedIntConst=94
IntHexConst=95
LongHexConst=96
UnsignedHexConst=97
FloatDoubleConst=98
DoubleDoubleConst=99
LongDoubleConst=100
NTypedefName=101
NInitDecl=102
NDeclarator=103
NStructDeclarator=104
NDeclaration=105
NCast=106
NPointerGroup=107
NExpressionGroup=108
NFunctionCallArgs=109
NNonemptyAbstractDeclarator=110
NInitializer=111
NStatementExpr=112
NEmptyExpression=113
NParameterTypeList=114
NFunctionDef=115
NCompoundStatement=116
NParameterDeclaration=117
NCommaExpr=118
NUnaryExpr=119
NLabel=120
NPostfixExpr=121
NRangeExpr=122
NStringSeq=123
NInitializerElementLabel=124
NLcurlyInitializer=125
NAsmAttribute=126
NGnuAsmExpr=127
NTypeMissing=128
Vocabulary=129
Whitespace=130
Comment=131
CPPComment=132
Space=133
LineDirective=134
BadStringLiteral=135
Escape=136
Digit=137
LongSuffix=138
UnsignedSuffix=139
FloatSuffix=140
Exponent=141
Number=142
LITERAL___label__="__label__"=143
LITERAL_inline="inline"=144
LITERAL___inline="__inline"=145
LITERAL_typeof="typeof"=146
LITERAL___complex="__complex"=147
LITERAL___attribute="__attribute"=148
LITERAL___alignof="__alignof"=149
LITERAL___real="__real"=150
LITERAL___imag="__imag"=151
--- NEW FILE: LineObject.java ---
class LineObject {
LineObject parent = null;
String source = "";
int line = 1;
boolean enteringFile = false;
boolean returningToFile = false;
boolean systemHeader = false;
boolean treatAsC = false;
public LineObject()
{
super();
}
public LineObject( LineObject lobj )
{
parent = lobj.getParent();
source = lobj.getSource();
line = lobj.getLine();
enteringFile = lobj.getEnteringFile();
returningToFile = lobj.getReturningToFile();
systemHeader = lobj.getSystemHeader();
treatAsC = lobj.getTreatAsC();
}
public LineObject( String src)
{
source = src;
}
public void setSource(String src)
{
source = src;
}
public String getSource()
{
return source;
}
public void setParent(LineObject par)
{
parent = par;
}
public LineObject getParent()
{
return parent;
}
public void setLine(int l)
{
line = l;
}
public int getLine()
{
return line;
}
public void newline()
{
line++;
}
public void setEnteringFile(boolean v)
{
enteringFile = v;
}
public boolean getEnteringFile()
{
return enteringFile;
}
public void setReturningToFile(boolean v)
{
returningToFile = v;
}
public boolean getReturningToFile()
{
return returningToFile;
}
public void setSystemHeader(boolean v)
{
systemHeader = v;
}
public boolean getSystemHeader()
{
return systemHeader;
}
public void setTreatAsC(boolean v)
{
treatAsC = v;
}
public boolean getTreatAsC()
{
return treatAsC;
}
public String toString() {
StringBuffer ret;
ret = new StringBuffer("# " + line + " \"" + source + "\"");
if (enteringFile) {
ret.append(" 1");
}
if (returningToFile) {
ret.append(" 2");
}
if (systemHeader) {
ret.append(" 3");
}
if (treatAsC) {
ret.append(" 4");
}
return ret.toString();
}
}
--- NEW FILE: Makefile ---
classfiles = LineObject.class PreprocessorInfoChannel.class StdCParser.class StdCLexer.class GnuCParser.class GnuCLexer.class GnuCTreeParser.class GnuCEmitter.class
javafiles = CSymbolTable.java TNode.java TNodeFactory.java CToken.java LineObject.java PreprocessorInfoChannel.java StdCParser.java StdCLexer.java GnuCParser.java GnuCLexer.java GnuCTreeParser.java GnuCEmitter.java
grammar.jar: $(classfiles)
jar cf grammar.jar $(classfiles)
all : $(javafiles) $(classfiles)
clean :
StdCParser.java StdCLexer.java : StdCParser.g
java antlr.Tool StdCParser.g
GnuCParser.java GnuCLexer.java : GnuCParser.g StdCParser.g
java antlr.Tool -glib "StdCParser.g" GnuCParser.g
GnuCTreeParser.java : GnuCTreeParser.g
java antlr.Tool GnuCTreeParser.g
GnuCEmitter.java : GnuCEmitter.g GnuCTreeParser.g
java antlr.Tool -glib "GnuCTreeParser.g" GnuCEmitter.g
.SUFFIXES: .java .class
.java.class :
javac $<
--- NEW FILE: PreprocessorInfoChannel.java ---
import java.util.*;
public class PreprocessorInfoChannel
{
Hashtable lineLists = new Hashtable(); // indexed by Token number
int firstValidTokenNumber = 0;
int maxTokenNumber = 0;
public void addLineForTokenNumber( Object line, Integer toknum )
{
if ( lineLists.containsKey( toknum ) ) {
Vector lines = (Vector) lineLists.get( toknum );
lines.addElement(line);
}
else {
Vector lines = new Vector();
lines.addElement(line);
lineLists.put(toknum, lines);
if ( maxTokenNumber < toknum.intValue() ) {
maxTokenNumber = toknum.intValue();
}
}
}
public int getMaxTokenNumber()
{
return maxTokenNumber;
}
public Vector extractLinesPrecedingTokenNumber( Integer toknum )
{
Vector lines = new Vector();
if (toknum == null) return lines;
for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){
Integer inti = new Integer(i);
if ( lineLists.containsKey( inti ) ) {
Vector tokenLineVector = (Vector) lineLists.get( inti );
if ( tokenLineVector != null) {
Enumeration tokenLines = tokenLineVector.elements();
while ( tokenLines.hasMoreElements() ) {
lines.addElement( tokenLines.nextElement() );
}
lineLists.remove(inti);
}
}
}
firstValidTokenNumber = toknum.intValue();
return lines;
}
public String toString()
{
StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n");
for (int i = 0; i <= maxTokenNumber + 1; i++){
Integer inti = new Integer(i);
if ( lineLists.containsKey( inti ) ) {
Vector tokenLineVector = (Vector) lineLists.get( inti );
if ( tokenLineVector != null) {
Enumeration tokenLines = tokenLineVector.elements();
while ( tokenLines.hasMoreElements() ) {
sb.append(inti + ":" + tokenLines.nextElement() + '\n');
}
}
}
}
return sb.toString();
}
}
--- NEW FILE: STDCTokenTypes.java ---
// $ANTLR 2.7.6 (2005-12-22): "StdCParser.g" -> "StdCLexer.java"$
public interface STDCTokenTypes {
int EOF = 1;
int NULL_TREE_LOOKAHEAD = 3;
int LITERAL_typedef = 4;
int PREPROC_DIRECTIVE = 5;
int LITERAL_asm = 6;
int LITERAL_volatile = 7;
int LCURLY = 8;
int RCURLY = 9;
int SEMI = 10;
int LITERAL_struct = 11;
int LITERAL_union = 12;
int LITERAL_enum = 13;
int LITERAL_auto = 14;
int LITERAL_register = 15;
int LITERAL_extern = 16;
int LITERAL_static = 17;
int LITERAL_const = 18;
int LITERAL_void = 19;
int LITERAL_char = 20;
int LITERAL_short = 21;
int LITERAL_int = 22;
int LITERAL_long = 23;
int LITERAL_float = 24;
int LITERAL_double = 25;
int LITERAL_signed = 26;
int LITERAL___builtin_va_list = 27;
int LITERAL_unsigned = 28;
int ID = 29;
int COMMA = 30;
int COLON = 31;
int ASSIGN = 32;
int STAR = 33;
int LITERAL___restrict = 34;
int LPAREN = 35;
int RPAREN = 36;
int LBRACKET = 37;
int RBRACKET = 38;
int VARARGS = 39;
int LITERAL_while = 40;
int LITERAL_do = 41;
int LITERAL_for = 42;
int LITERAL_goto = 43;
int LITERAL_continue = 44;
int LITERAL_break = 45;
int LITERAL_return = 46;
int LITERAL_case = 47;
int LITERAL_default = 48;
int LITERAL_if = 49;
int LITERAL_else = 50;
int LITERAL_switch = 51;
int DIV_ASSIGN = 52;
int PLUS_ASSIGN = 53;
int MINUS_ASSIGN = 54;
int STAR_ASSIGN = 55;
int MOD_ASSIGN = 56;
int RSHIFT_ASSIGN = 57;
int LSHIFT_ASSIGN = 58;
int BAND_ASSIGN = 59;
int BOR_ASSIGN = 60;
int BXOR_ASSIGN = 61;
int QUESTION = 62;
int LOR = 63;
int LAND = 64;
int BOR = 65;
int BXOR = 66;
int BAND = 67;
int EQUAL = 68;
int NOT_EQUAL = 69;
int LT = 70;
int LTE = 71;
int GT = 72;
int GTE = 73;
int LSHIFT = 74;
int RSHIFT = 75;
int PLUS = 76;
int MINUS = 77;
int DIV = 78;
int MOD = 79;
int INC = 80;
int DEC = 81;
int LITERAL_sizeof = 82;
int BNOT = 83;
int LNOT = 84;
int PTR = 85;
int DOT = 86;
int CharLiteral = 87;
int StringLiteral = 88;
int IntOctalConst = 89;
int LongOctalConst = 90;
int UnsignedOctalConst = 91;
int IntIntConst = 92;
int LongIntConst = 93;
int UnsignedIntConst = 94;
int IntHexConst = 95;
int LongHexConst = 96;
int UnsignedHexConst = 97;
int FloatDoubleConst = 98;
int DoubleDoubleConst = 99;
int LongDoubleConst = 100;
int NTypedefName = 101;
int NInitDecl = 102;
int NDeclarator = 103;
int NStructDeclarator = 104;
int NDeclaration = 105;
int NCast = 106;
int NPointerGroup = 107;
int NExpressionGroup = 108;
int NFunctionCallArgs = 109;
int NNonemptyAbstractDeclarator = 110;
int NInitializer = 111;
int NStatementExpr = 112;
int NEmptyExpression = 113;
int NParameterTypeList = 114;
int NFunctionDef = 115;
int NCompoundStatement = 116;
int NParameterDeclaration = 117;
int NCommaExpr = 118;
int NUnaryExpr = 119;
int NLabel = 120;
int NPostfixExpr = 121;
int NRangeExpr = 122;
int NStringSeq = 123;
int NInitializerElementLabel = 124;
int NLcurlyInitializer = 125;
int NAsmAttribute = 126;
int NGnuAsmExpr = 127;
int NTypeMissing = 128;
int Vocabulary = 129;
int Whitespace = 130;
int Comment = 131;
int CPPComment = 132;
int Space = 133;
int LineDirective = 134;
int BadStringLiteral = 135;
int Escape = 136;
int Digit = 137;
int LongSuffix = 138;
int UnsignedSuffix = 139;
int FloatSuffix = 140;
int Exponent = 141;
int Number = 142;
}
--- NEW FILE: STDCTokenTypes.txt ---
// $ANTLR 2.7.6 (2005-12-22): StdCParser.g -> STDCTokenTypes.txt$
STDC // output token vocab name
LITERAL_typedef="typedef"=4
PREPROC_DIRECTIVE("a line directive")=5
LITERAL_asm="asm"=6
LITERAL_volatile="volatile"=7
LCURLY=8
RCURLY=9
SEMI=10
LITERAL_struct="struct"=11
LITERAL_union="union"=12
LITERAL_enum="enum"=13
LITERAL_auto="auto"=14
LITERAL_register="register"=15
LITERAL_extern="extern"=16
LITERAL_static="static"=17
LITERAL_const="const"=18
LITERAL_void="void"=19
LITERAL_char="char"=20
LITERAL_short="short"=21
LITERAL_int="int"=22
LITERAL_long="long"=23
LITERAL_float="float"=24
LITERAL_double="double"=25
LITERAL_signed="signed"=26
LITERAL___builtin_va_list="__builtin_va_list"=27
LITERAL_unsigned="unsigned"=28
ID=29
COMMA=30
COLON=31
ASSIGN=32
STAR=33
LITERAL___restrict="__restrict"=34
LPAREN=35
RPAREN=36
LBRACKET=37
RBRACKET=38
VARARGS=39
LITERAL_while="while"=40
LITERAL_do="do"=41
LITERAL_for="for"=42
LITERAL_goto="goto"=43
LITERAL_continue="continue"=44
LITERAL_break="break"=45
LITERAL_return="return"=46
LITERAL_case="case"=47
LITERAL_default="default"=48
LITERAL_if="if"=49
LITERAL_else="else"=50
LITERAL_switch="switch"=51
DIV_ASSIGN=52
PLUS_ASSIGN=53
MINUS_ASSIGN=54
STAR_ASSIGN=55
MOD_ASSIGN=56
RSHIFT_ASSIGN=57
LSHIFT_ASSIGN=58
BAND_ASSIGN=59
BOR_ASSIGN=60
BXOR_ASSIGN=61
QUESTION=62
LOR=63
LAND=64
BOR=65
BXOR=66
BAND=67
EQUAL=68
NOT_EQUAL=69
LT=70
LTE=71
GT=72
GTE=73
LSHIFT=74
RSHIFT=75
PLUS=76
MINUS=77
DIV=78
MOD=79
INC=80
DEC=81
LITERAL_sizeof="sizeof"=82
BNOT=83
LNOT=84
PTR=85
DOT=86
CharLiteral=87
StringLiteral=88
IntOctalConst=89
LongOctalConst=90
UnsignedOctalConst=91
IntIntConst=92
LongIntConst=93
UnsignedIntConst=94
IntHexConst=95
LongHexConst=96
UnsignedHexConst=97
FloatDoubleConst=98
DoubleDoubleConst=99
LongDoubleConst=100
NTypedefName=101
NInitDecl=102
NDeclarator=103
NStructDeclarator=104
NDeclaration=105
NCast=106
NPointerGroup=107
NExpressionGroup=108
NFunctionCallArgs=109
NNonemptyAbstractDeclarator=110
NInitializer=111
NStatementExpr=112
NEmptyExpression=113
NParameterTypeList=114
NFunctionDef=115
NCompoundStatement=116
NParameterDeclaration=117
NCommaExpr=118
NUnaryExpr=119
NLabel=120
NPostfixExpr=121
NRangeExpr=122
NStringSeq=123
NInitializerElementLabel=124
NLcurlyInitializer=125
NAsmAttribute=126
NGnuAsmExpr=127
NTypeMissing=128
Vocabulary=129
Whitespace=130
Comment=131
CPPComment=132
Space=133
LineDirective=134
BadStringLiteral=135
Escape=136
Digit=137
LongSuffix=138
UnsignedSuffix=139
FloatSuffix=140
Exponent=141
Number=142
--- NEW FILE: StdCLexer.java ---
// $ANTLR 2.7.6 (2005-12-22): "StdCParser.g" -> "StdCLexer.java"$
import java.io.InputStream;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import antlr.ANTLRException;
import java.io.Reader;
import java.util.Hashtable;
import antlr.CharScanner;
import antlr.InputBuffer;
import antlr.ByteBuffer;
import antlr.CharBuffer;
import antlr.Token;
import antlr.CommonToken;
import antlr.RecognitionException;
import antlr.NoViableAltForCharException;
[...2613 lines suppressed...]
data[0]=-17179878401L;
data[1]=-268435457L;
for (int i = 2; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
private static final long[] mk_tokenSet_9() {
long[] data = { 287949450930814976L, 541165879422L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
private static final long[] mk_tokenSet_10() {
long[] data = new long[8];
data[0]=-549755813889L;
for (int i = 1; i<=3; i++) { data[i]=-1L; }
return data;
}
public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
}
--- NEW FILE: StdCLexer.smap ---
SMAP
StdCLexer.java
G
*S G
*F
+ 0 StdCParser.g
StdCParser.g
*L
0:164
0:170
0:176
0:182
0:188
0:194
0:200
0:206
0:212
0:218
0:224
[...1727 lines suppressed...]
1364:2053
1364:2054
1364:2055
1364:2056
1364:2057
1364:2058
1364:2059
1364:2060
1364:2061
1364:2062
1364:2063
1364:2064
1364:2065
1364:2066
1364:2067
1364:2068
1364:2069
1364:2071
1364:2072
*E
--- NEW FILE: StdCParser.g ---
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Non, Inc. 1997 -- All Rights Reserved
PROJECT: C Compiler
MODULE: Parser
FILE: stdc.g
AUTHOR: John D. Mitchell (john at non.net), Jul 12, 1997
REVISION HISTORY:
Name Date Description
---- ---- -----------
JDM 97.07.12 Initial version.
JTC 97.11.18 Declaration vs declarator & misc. hacking.
JDM 97.11.20 Fixed: declaration vs funcDef,
parenthesized expressions,
declarator iteration,
[...1328 lines suppressed...]
)?
| '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+
{ _ttype = IntHexConst; }
( LongSuffix { _ttype = LongHexConst; }
| UnsignedSuffix { _ttype = UnsignedHexConst; }
)?
;
ID
options
{
testLiterals = true;
}
: ( 'a'..'z' | 'A'..'Z' | '_' )
( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )*
;
--- NEW FILE: StdCParser.java ---
// $ANTLR 2.7.6 (2005-12-22): "StdCParser.g" -> "StdCParser.java"$
import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;
import antlr.collections.AST;
import java.util.Hashtable;
import antlr.ASTFactory;
import antlr.ASTPair;
[...6125 lines suppressed...]
return data;
}
public static final BitSet _tokenSet_66 = new BitSet(mk_tokenSet_66());
private static final long[] mk_tokenSet_67() {
long[] data = { -4503067588295136L, 137438953471L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_67 = new BitSet(mk_tokenSet_67());
private static final long[] mk_tokenSet_68() {
long[] data = { -4503239923857888L, 65535L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_68 = new BitSet(mk_tokenSet_68());
private static final long[] mk_tokenSet_69() {
long[] data = { -4503068125166048L, 6553599L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_69 = new BitSet(mk_tokenSet_69());
}
--- NEW FILE: StdCParser.smap ---
SMAP
StdCParser.java
G
*S G
*F
+ 0 StdCParser.g
StdCParser.g
*L
73:30
74:31
75:32
76:33
77:34
79:36
80:37
82:39
83:40
84:41
85:42
[...4547 lines suppressed...]
916:5621
916:5622
916:5623
917:5615
917:5627
917:5628
917:5629
917:5630
917:5631
917:5632
918:5624
918:5636
918:5637
918:5638
918:5639
918:5640
918:5641
919:5633
920:5642
*E
--- NEW FILE: TNode.java ---
import antlr.collections.AST;
import antlr.CommonAST;
import antlr.Token;
import java.lang.reflect.*;
import java.util.Hashtable;
import java.util.Enumeration;
//import CToken;
/**
Class TNode is an implementation of the AST interface
and adds many useful features:
It is double-linked for reverse searching.
(this is currently incomplete, in that method doubleLink() must
be called after any changes to the tree to maintain the
reverse links).
It can store a definition node (defNode), so that nodes such
as scoped names can refer to the node that defines the name.
It stores line numbers for nodes.
Searches for parents and children of a tree can be done
based on their type.
The tree can be printed to System.out using a lisp-style syntax.
*/
public class TNode extends CommonAST {
protected int ttype;
protected String text;
protected int lineNum = 0;
protected TNode defNode;
protected TNode up;
protected TNode left;
protected boolean marker = false;
protected Hashtable attributes = null;
static String tokenVocabulary;
/** Set the token vocabulary to a tokentypes class
generated by antlr.
*/
public static void setTokenVocabulary(String s) {
tokenVocabulary = s;
}
public void initialize(Token token) {
CToken tok = (CToken) token;
setText(tok.getText());
setType(tok.getType());
setLineNum(tok.getLine());
setAttribute("source", tok.getSource());
setAttribute("tokenNumber", new Integer(tok.getTokenNumber()));
}
public void initialize(AST tr) {
TNode t = (TNode) tr;
setText(t.getText());
setType(t.getType());
setLineNum(t.getLineNum());
setDefNode(t.getDefNode());
this.attributes = t.getAttributesTable();
}
/** Get the token type for this node */
public int getType() { return ttype; }
/** Set the token type for this node */
public void setType(int ttype_) {
ttype = ttype_;
}
/** Get the marker value for this node.
This member is a general-use marker.
*/
public boolean getMarker() { return marker; }
/** Set the marker value for this node.
This property is a general-use boolean marker.
*/
public void setMarker(boolean marker_) {
marker = marker_;
}
/** get the hashtable that holds attribute values.
*/
public Hashtable getAttributesTable() {
if(attributes == null)
attributes = new Hashtable(7);
return attributes;
}
/** set an attribute in the attribute table.
*/
public void setAttribute(String attrName, Object value) {
if(attributes == null)
attributes = new Hashtable(7);
attributes.put(attrName,value);
}
/** lookup the attribute name in the attribute table.
If the value does not exist, it returns null.
*/
public Object getAttribute(String attrName) {
if(attributes == null)
return null;
else
return attributes.get(attrName);
}
/** Get the line number for this node.
If the line number is 0, search for a non-zero line num among children */
public int getLineNum() {
if(lineNum != 0)
return lineNum;
else
if(down == null)
return lineNum;
else
return ((TNode)down).getLocalLineNum();
}
public int getLocalLineNum() {
if(lineNum != 0)
return lineNum;
else
if(down == null)
if(right == null)
return lineNum;
else
return ((TNode)right).getLocalLineNum();
else
return ((TNode)down).getLocalLineNum();
}
/** Set the line number for this node */
public void setLineNum(int lineNum_) {
lineNum = lineNum_;
}
/** Get the token text for this node */
public String getText() { return text; }
/** Set the token text for this node */
public void setText(String text_) {
text = text_;
}
/** return the last child of this node, or null if there is none */
public TNode getLastChild() {
TNode down = (TNode)getFirstChild();
if(down != null)
return down.getLastSibling();
else
return null;
}
/** return the last sibling of this node, which is
this if the next sibling is null */
public TNode getLastSibling() {
TNode next = (TNode)getNextSibling();
if(next != null)
return next.getLastSibling();
else
return this;
}
public TNode getPrevSibling(){
return (TNode)left;
}
/** return the first sibling of this node, which is
this if the prev sibling is null */
public TNode getFirstSibling() {
TNode prev = (TNode)left;
if(prev != null)
return prev.getFirstSibling();
else
return this;
}
/** return the parent node of this node */
public TNode getParent() {
return (TNode)getFirstSibling().up;
}
/** add the new node as a new sibling, inserting it ahead of any
existing next sibling. This method maintains double-linking.
if node is null, nothing happens. If the node has siblings,
then they are added in as well.
*/
public void addSibling(AST node) {
if(node == null) return;
TNode next = (TNode)right;
right = (TNode)node;
((TNode)node).left = this;
TNode nodeLastSib = ((TNode)node).getLastSibling();
nodeLastSib.right = next;
if(next != null)
next.left = nodeLastSib;
}
public void addSiblingBefore(AST node) {
if(node == null) return;
TNode before = (TNode)left;
left = (TNode)node;
((TNode)node).right = this;
((TNode)node).left = before;
//TNode nodeLastSib = ((TNode)node).getLastSibling();
//nodeLastSib.right = next;
if(before != null)
before.right = (TNode)node;
else{
if(up!=null){
((TNode)node).up = up;
up.down = (TNode)node;
up=null;
}
}
}
public void makeAlone(){
up = null;
down=null;
right=null;
left=null;
}
/** return the number of children of this node */
public int numberOfChildren() {
int count = 0;
AST child = getFirstChild();
while(child != null) {
count++;
child = child.getNextSibling();
}
return count;
}
/** remove this node from the tree, resetting sibling and parent
pointers as necessary. This method maintains double-linking */
public void removeSelf() {
TNode parent = (TNode)up;
TNode prev = (TNode)left;
TNode next = (TNode)right;
if(parent != null) {
parent.down = next;
if(next != null) {
next.up = parent;
next.left = prev; // which should be null
}
}
else {
if(prev != null)
prev.right = next;
if(next != null)
next.left = prev;
}
}
/** return the def node for this node */
public TNode getDefNode() {
return defNode;
}
/** set the def node for this node */
public void setDefNode(TNode n) {
defNode = n;
}
/** return a deep copy of this node, and all sub nodes.
New tree is doubleLinked, with no parent or siblings.
Marker value is not copied!
*/
public TNode deepCopy() {
TNode copy = new TNode();
copy.ttype = ttype;
copy.text = text;
copy.lineNum = lineNum;
copy.defNode = defNode;
if(attributes != null)
copy.attributes = (Hashtable)attributes.clone();
if(down != null)
copy.down = ((TNode)down).deepCopyWithRightSiblings();
copy.doubleLink();
return copy;
}
/** return a deep copy of this node, all sub nodes,
and right siblings.
New tree is doubleLinked, with no parent or left siblings.
defNode is not copied */
public TNode deepCopyWithRightSiblings() {
TNode copy = new TNode();
copy.ttype = ttype;
copy.text = text;
copy.lineNum = lineNum;
copy.defNode = defNode;
if(attributes != null)
copy.attributes = (Hashtable)attributes.clone();
if(down != null)
copy.down = ((TNode)down).deepCopyWithRightSiblings();
if(right != null)
copy.right = ((TNode)right).deepCopyWithRightSiblings();
copy.doubleLink();
return copy;
}
/** return a short string representation of the node */
public String toString() {
StringBuffer str = new StringBuffer( getNameForType(getType()) +
"[" + getText() + ", " + "]");
if(this.getLineNum() != 0)
str.append(" line:" + (this.getLineNum() ) );
Enumeration keys = (this.getAttributesTable().keys());
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
str.append(" " + key + ":" + (this.getAttribute(key)));
}
return str.toString();
}
/** print given tree to System.out */
public static void printTree(AST t) {
if (t == null) return;
printASTNode(t,0);
System.out.print("\n");
}
/** protected method that does the work of printing */
protected static void printASTNode(AST t, int indent) {
AST child1, next;
child1 = t.getFirstChild();
System.out.print("\n");
for(int i = 0; i < indent; i++)
System.out.print(" ");
if(child1 != null)
System.out.print("(");
String s = t.getText();
if(s != null && s.length() > 0) {
System.out.print(getNameForType(t.getType()));
System.out.print(": \"" + s + "\"");
}
else
System.out.print(getNameForType(t.getType()));
if(((TNode)t).getLineNum() != 0)
System.out.print(" line:" + ((TNode)t).getLineNum() );
Enumeration keys = ((TNode)t).getAttributesTable().keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
System.out.print(" " + key + ":" + ((TNode)t).getAttribute(key));
}
TNode def = ((TNode)t).getDefNode();
if(def != null)
System.out.print("[" + getNameForType(def.getType()) + "]");
if(child1 != null) {
printASTNode(child1,indent + 1);
System.out.print("\n");
for(int i = 0; i < indent; i++)
System.out.print(" ");
System.out.print(")");
}
next = t.getNextSibling();
if(next != null) {
printASTNode(next,indent);
}
}
/** converts an int tree token type to a name.
Does this by reflecting on nsdidl.IDLTreeTokenTypes,
and is dependent on how ANTLR 2.00 outputs that class. */
public static String getNameForType(int t) {
try{
Class c = Class.forName(tokenVocabulary);
Field[] fields = c.getDeclaredFields();
if(t-2 < fields.length)
return fields[t-2].getName();
} catch (Exception e) { System.out.println(e); }
return "unfoundtype: " + t;
}
/** set up reverse links between this node and its first
child and its first sibling, and link those as well */
public void doubleLink() {
TNode right = (TNode)getNextSibling();
if(right != null) {
right.left = this;
right.doubleLink();
}
TNode down = (TNode)getFirstChild();
if(down != null) {
down.up = this;
down.doubleLink();
}
}
/** find first parent of the given type,
return null on failure */
public TNode parentOfType(int type) {
if(up == null) {
if(left == null)
return null;
else
return left.parentOfType(type);
}
if(up.getType() == type)
return up;
return up.parentOfType(type);
}
/** find the first child of the node
of the given type, return null on failure */
public TNode firstChildOfType(int type) {
TNode down = (TNode)getFirstChild();
if(down == null)
return null;
if(down.getType() == type)
return down;
return down.firstSiblingOfType(type);
}
/** find the first sibling of the node
of the given type, return null on failure */
public TNode firstSiblingOfType(int type) {
TNode right = (TNode)getNextSibling();
if(right == null)
return null;
if(right.getType() == type)
return right;
return right.firstSiblingOfType(type);
}
}
--- NEW FILE: TNodeFactory.java ---
import antlr.Token;
import antlr.ASTFactory;
import antlr.collections.AST;
/** This class extends ASTFactory to build instances
of class TNode */
public class TNodeFactory extends ASTFactory {
/** Create a new ampty AST node */
public AST create() {
return new TNode();
}
/** Create a new AST node from type and text */
public AST create(int ttype, String text) {
AST ast = new TNode();
ast.setType(ttype);
ast.setText(text);
return ast;
}
/** Create a new AST node from an existing AST node */
public AST create(AST ast) {
AST newast = new TNode();
newast.setType(ast.getType());
newast.setText(ast.getText());
return newast;
}
}
--- NEW FILE: expandedGnuCEmitter.g ---
{
import java.io.*;
import java.util.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
}class GnuCEmitter extends TreeParser;
options {
importVocab= GNUC;
buildAST= false;
ASTLabelType= "TNode";
codeGenMakeSwitchThreshold= 2;
codeGenBitsetTestThreshold= 3;
}
{
String p2="";
String l2="";
[...1444 lines suppressed...]
| #( GTE expr expr)
;
// inherited from grammar GnuCTreeParser
shiftExpr :#( LSHIFT expr expr)
| #( RSHIFT expr expr)
;
// inherited from grammar GnuCTreeParser
additiveExpr :#( PLUS expr expr)
| #( MINUS expr expr)
;
// inherited from grammar GnuCTreeParser
multExpr :#( STAR expr expr)
| #( DIV expr expr)
| #( MOD expr expr)
;
--- NEW FILE: expandedGnuCParser.g ---
{
import java.io.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
}class GnuCParser extends Parser;
options {
k= 2;
exportVocab= GNUC;
buildAST= true;
ASTLabelType= "TNode";
codeGenMakeSwitchThreshold= 2;
codeGenBitsetTestThreshold= 3;
importVocab=STDC;
}
{
// Suppport C++-style single-line comments?
[...1304 lines suppressed...]
// inherited from grammar StdCLexer
protected IntIntConst :;
// inherited from grammar StdCLexer
protected LongIntConst :;
// inherited from grammar StdCLexer
protected UnsignedIntConst :;
// inherited from grammar StdCLexer
protected IntHexConst :;
// inherited from grammar StdCLexer
protected LongHexConst :;
// inherited from grammar StdCLexer
protected UnsignedHexConst :;
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x-contrib/timetossim/tinyos-2.x/tools/cgram/examples AsmParser.java, NONE, 1.1 FileList.java, NONE, 1.1 Line.java, NONE, 1.1 Makefile, NONE, 1.1 Postmartem.java, NONE, 1.1 PreMica2.java, NONE, 1.1 PreTossim.java, NONE, 1.1 Preprocessor.java, NONE, 1.1 SourceFile.java, NONE, 1.1 SourceLine.java, NONE, 1.1 TempTest.java, NONE, 1.1 Test.java, NONE, 1.1 TestLex.java, NONE, 1.1 TestThrough.java, NONE, 1.1 TestThrough.java~, NONE, 1.1 check_time3.c, NONE, 1.1 check_time3b.c, NONE, 1.1 tTossim.jar, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/c/sf serialsource.c, 1.2, 1.3 serialsource.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list