home *** CD-ROM | disk | FTP | other *** search
-
- /* C++ Grammar ...so far. by John M. Dlugosz */
-
- /* TOKENS. */
-
- <error>
- <identifier> => KW_SEARCH
- <operator> => OP_SEARCH
- <punctuator> => OP_SEARCH
- <number>
- <string>
- <eof>
- <type>
-
- /* KEYWORDS. */
-
- auto break case cdecl char class const continue default delete do
- double else enum extern far float for friend goto huge if inline int
- interrupt long near new operator overload pascal private protected
- public register return short signed sizeof static struct switch this
- typedef union unsigned virtual void volatile while
-
- /* OPERATORS. */
-
- || &&
- < <= == > >=
- + - * / %
- ? ++ -- '->'
- ! ~ ^ '|' & >> <<
- = <<= != %= &= *= += -= /= |= >>= ^=
-
- /* PUNCTUATORS. */
-
- '...' . , : ; [ ] { } ( ) ::
-
- /* NONTERMINALS. */
-
- Input -> File_and_tell <eof>
-
- File_and_tell -> File => AllDoneNow 1 /* normal completion */
-
- File -> Item | File Item
-
- Item -> Declaration
- /* or Definition. not in yet. */
-
-
- /**************************************************************
- To recognize a declaration, the storage class and type appear
- once. They are remembered. Each declaration is seperated by
- commas, and share the same type. The FinishedDeclarator calls
- an action for each one found.
- ****************/
-
- Declaration
- -> StorageClass Type_w/const Declarators ;
-
- Declarators
- -> FinishedDeclarator
- -> FinishedDeclarator , Declarators
-
- FinishedDeclarator -> Declarator Initializer? => Declaration 1
-
- /*********************************/
-
-
- Initializer?
- ->
- -> = Expression
- -> = { Expression-List }
- /* -> ( Expression-List ) */
-
- Expression-List
- -> Expression
- -> Expression Expression-List
-
-
- StorageClass
- -> => StoreStorage 0
- -> static => StoreStorage 1
- -> extern => StoreStorage 2
- -> typedef => StoreStorage 3
- -> auto => StoreStorage 4
- -> register => StoreStorage 5
-
- Type_w/const /* const may appear before or after the type name */
- -> Const/Volatile? Type Const/Volatile? => StoreBaseConstVol
-
- Type
- -> char => StoreType 1
- -> signed char => StoreType 2
- -> unsigned char => StoreType 3
- -> int => StoreType 4
- -> short => StoreType 4
- -> short int => StoreType 4
- -> signed int => StoreType 4
- -> signed short => StoreType 4
- -> signed short int => StoreType 4
- -> unsigned => StoreType 5
- -> unsigned int => StoreType 5
- -> unsigned short => StoreType 5
- -> unsigned short int => StoreType 5
- -> long => StoreType 6
- -> signed long => StoreType 6
- -> unsigned long => StoreType 7
- -> float => StoreType 8
- -> double => StoreType 9
- -> long double => StoreType 10
- -> void => StoreType 11
- -> enum Tag => StoreType 12
- -> Class Tag => StoreType 13
- -> union Tag => StoreType 14
-
- Tag
- -> <identifier> => StoreTag 1
- -> <type> => StoreTag 2
-
- Class
- -> struct
- -> class
-
- OverloadableOp -> * | / | = | + /* and all the others */
-
- Elipses? -> | '...'
-
- /* Declarations */
-
- Declarator
- -> Decl2
- -> ReachAttribute * Const/Volatile? Declarator => TypeModifier 3
- -> ReachAttribute & Const/Volatile? Declarator => TypeModifier 4
-
- Decl2
- -> Decl2 ( Arg-Declaration-List ) => TypeModifier 1
- -> Decl2 [ ConstExp? ] => TypeModifier 2
- -> Decl3
-
- Decl3
- -> Dname => Dname 1
- -> ( Declarator )
-
- Const/Volatile? /* const or volotile, neither, or both */
- -> => ConstVol 0
- -> const => ConstVol 1
- -> volatile => ConstVol 2
- -> const volatile => ConstVol 3
- -> volatile const => ConstVol 3
-
-
- ReachAttribute
- -> => ReachType 0
- -> near => ReachType 4
- -> far => ReachType 8
-
- Dname
- -> SimpleDname
- -> <type> :: SimpleDname
-
- SimpleDname
- -> <identifier>
- -> <type>
- -> ~ <type>
- -> Operator-FunctionName
-
- Operator-FunctionName
- -> operator OverloadableOp /* overload operator */
- -> operator <type> /* conversion operator */
- /* this should really allow any abstract type definition, not just
- a simple type name. I'll change it later */
- -> operator <identifier> /* ERROR production */
-
-
- /* Argument list for function declarations */
-
- Arg-Declaration-List
- -> Start-Nested-Type A-Decl-List? Elipses? End-Nested-Type
-
- Start-Nested-Type -> => NestedType 1
- End-Nested-Type -> => NestedType 0
-
- A-Decl-List?
- ->
- -> A-Decl-List
-
- A-Decl-List
- -> A-Decl-List , Argument-Declaration
- -> Argument-Declaration
-
- Argument-Declaration
- -> StorageClass Type_w/const Declarator => Declaration 2
-
- /* Expressions */
-
- ConstExp?
- ->
- -> ConstExp
-
- ConstExp -> Expression /* semantics will check */
-
- Expression
- /* stub out for now */
- -> <identifier>
- -> <number>
- -> <string>
-
-
-