[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

B. EBNF syntax for treecc input files

The EBNF syntax for treecc input files uses the following lexical tokens:

IDENTIFIER ::= <A-Za-z_> { <A-Za-z0-9_> }
STRING ::= '"' <anything that does not include '"'> '"'
 | "'" <anything that does not include "'"> "'"
LITERAL_DEFNS ::= "%{" <anything except "%}"> "%}"
LITERAL_END ::= "%%" <any character sequence until EOF>
LITERAL_CODE ::= '{' <anything with matched '{' and '}'> '}'

In addition, anything that begins with "%" in the following syntax is a lexical keyword.

The EBNF syntax is as follows:

File ::= { Declaration }
Declaration ::= Node
 | Operation
 | OperationCase
 | Option
 | Enum
 | Literal
 | Header
 | Output
 | Common
 | Include
Node ::= %node IDENTIFIER [ IDENTIFIER ] { NodeFlag } [ '=' Fields ]
NodeFlag ::= %abstract | %typedef
Fields ::= '{' { Field } '}'
Field ::= [ %nocreate ] TypeAndName [ '=' LITERAL_CODE ] ';'
TypeAndName ::= Type [ IDENTIFIER ]
Type ::= TypeName
 | Type '*'
 | Type '&'
 | Type '[' ']'
TypeName ::= IDENTIFIER { IDENTIFIER }
Operation ::= %operation { OperFlag } Type
 [ ClassName ] IDENTIFIER '(' [ Params ] ')'
 [ '=' LITERAL_CODE ] [ ';' ]
OperFlag ::= %virtual | %inline | %split
ClassName ::= IDENTIFIER "::"
Params ::= Param { ',' Param }
Param ::= TypeAndName | '[' TypeAndName ']'
OperationCase ::= OperationHead { ',' OperationHead } LITERAL_CODE
OperationHead ::= IDENTIFIER '(' [ TypeList ] ')'
TypeList ::= IDENTIFIER { ',' IDENTIFIER }
Option ::= %option IDENTIFIER [ '=' Value ]
Value ::= IDENTIFIER | STRING
Enum ::= %enum IDENTIFIER '=' '{' EnumBody [ ',' ] '}'
EnumBody ::= IDENTIFIER { ',' IDENTIFIER }
Literal ::= { LiteralFlag } (LITERAL_DEFNS | LITERAL_END)
LiteralFlag ::= %both | %decls | %end
Header ::= %header STRING
Output ::= %output STRING
Common ::= %common
Include ::= %include [ %readonly ] STRING

[ << ] [ >> ] [Top] [Contents] [Index] [ ? ]

This document was generated by Klaus Treichel on January, 18 2009 using texi2html 1.78.

AltStyle によって変換されたページ (->オリジナル) /