JavaSrc::=
[package <classpath?PackageDefinition> ; ]
[ {<?importStatement> [/**[><description>*/]] import
{<$?package>\.}[<$?class>|List|LinkedList|ArrayList|Iterator|Class|Map|TreeMap|*<?allClasses>] ; } ]
{ <classDefinition> | <interfaceDefinition> }
.
$keywords::=class|interface|super|new|return|if|else|while|do|for|switch|case|static|final|abstract|private|protected|pu
lic|try|catch|throws|throw. ##|List|LinkedList|ArrayList|Iterator|Class|Map|TreeMap.
description::= <*{ * }|*/?!test_description>.
##The test_desciption syntax is used to parse the inner structure of a description.
test_description::= <*@\e?text>
[{ @return <*@\e?returnDescription>
|<?param> @param <$?name> <*|@param|@throws|@deprecated|@return|\e?!paramDescription>
| @sizeof = <*@\e?sizeofDescription>
|<?staticInstance> @Java2C = staticInstance <*@\e?text>
| @Java2C = { <$?Java2CTag> ? , } <*@\e?>
| @java2c = [>{ <java2cTag?> ? , } [:|\.]] <*@\e?rest>
| @ <*@\e?auxDescription>
}] \e.
paramDescription::= <*@\e?text>
[{ @java2c = [>{ <java2cTag?> ? , } [:|\.]] <*@\e?rest>
| @ <*@\e?auxDescription>
}] \e.
java2cTag::=
[> xxx ##abort translation of nothing matched. The xxx is necessary because every path has <?semenatic>
|<?fixStringBuffer> fixStringBuffer ##to final StringBuffer name = new StringBuffer(123);
|<?simpleArray> simpleArray ##to array def: no head informations.
|<?staticInstance> staticInstance ##to class
|<?embeddedYElements> embeddedArrayElements ##to array def: all elements are embedded
|<?noObject> noObject ##to class: no superclass ObjectJc
|<?noGC> noGC ##no refernece
|<?nonPersistent> nonPersistent ##
|<?stackInstance> stackInstance ##new creates an instance in stack
|<?zeroTermString> zeroTermString ##to String name; a const char*
].
?en:java2cTag/nonPersistent::="A reference which is designed as non-persistent, shouldn't be stored and used in another
threads.".
classDefinition::= [/**[><description>*/]] [<Modifier?>] class <$?classident>
[extends [<?Superclass> {<$?>?\.} ]]
[implements {<?ImplementedInterface> {<$?>?\.} ? , }]
\{ <classContent?>
\}.
classContent::=
{ ##[/**<description?-?>*/]
[ <variableDefinition> ;
| <methodDefinition>
| <constructorDefinition>
| <classDefinition>
| <interfaceDefinition>
| ;
]
}.
##An envIdent is a ident in a possible environment class.
## <?name> is the outest environment class, inside a <?envIdent> there is the next inner <?name> etc.
##environment::= [{<?environment> <$?@name> \.}] .
envIdent::= <$?@name> \. [<envIdent?subIdent>] .
typeIdent::= [<envIdent>] <$?@name>.
type::=
[
## [<?name>List|LinkedList|ArrayList|Iterator|Class|ConcurrentLinkedQueue][ \< <type?ContainerElementType> \>|\ ]
##| [<?name>Map|TreeMap|ArrayList|Iterator|Class][ \< <type?ContainerElementType> \>\< <type?ContainerElementType2> \>|
\ ]
##|
<typeIdent>
[\< { <type?ContainerElementType> ? , } \>]
] [{ <?typeArray> \[ \]}].
methodDefinition::=
[{ /**[><description>*/]
| @Override<?A_Override>
| @SuppressWarnings(<""?>)
}]
[<Modifier>] <type> <$?name> ( [<argumentList>] )
[ <throwsDeclaration>]
[ <?abstractMethod> ;
| <statementBlock?methodbody>
].
constructorDefinition::=
[{ /**[><description>*/]
| @SuppressWarnings(<""?>)
}]
[<Modifier>] <$?constructor>
( [<argumentList>] ) ##a
[ <throwsDeclaration>]
\{ [<?superCall> super ( [<actualArguments>] ); ]
[{ <variableDefinition?+?> ; | <statement> }]
\}.
throwsDeclaration::= throws { [<?ThrowsException> {<$?>?\.}|!] ? , }.
interfaceDefinition::= [/**[><description>*/]] [<Modifier?>] interface <$?classident>
[extends <$?SuperInterface>]
\{
{ [ <methodDefinition>
| <constructorDefinition>
| <interfaceDefinition>
| <classDefinition>
]
}
\}.
classpath::={<$?packageClassName>?\.}.
importpath::={<$?package>\.}[<$?class>|*<?allClasses>].
AccessRight::=<?>[ public<?public> | private<?private> | protected<?protected> |].
##NOTE: write <AccessRight> at last position of alternative because if 'package private' is set (no keyword, no
content), the repetition is broken off.
## it is a Java specification problem!
Modifier::=<?>{[synchronized<?synchronized> | static<?static> | final<?final> | volatile<?volatile> |
abstract<?abstract> | <AccessRight> ]}.
statement::=
[/*<description>*/]
[ \{ \} <?+emtypStatementBlock>
| ; <?emptyStatement>
| <statementBlock>
| <if_statement>
| <switch_statement>
| <while_statement>
| <dowhile_statement>
| <forElement_statement>
| <for_statement>
|<?throwNew> throw new <$?exceptionClass>(<value?text>[,<value?value2>]) ;
| <try_statement>
|<?return> return [ <value> |] ;
|<?break_statement> break ;
| <simpleValue?> ; ##a methodcall is syntactical the same as a simpleValue calling a simple Method
| <assignment> ;
]
.
assignment::=[<?leftValue> [<reference>] <simpleVariable?>] [ <assignOperator> <value> | ++ <?increment> | --
<?decrement> ] .
assignOperator::=<?> [<?@assignOperator> = | += | -= | *= | /= | &= | \|= | \<\<= | \>\>= ] .
if_statement::=if ( <condition> ) [ ;<?noAction> | <statement>] [ else [ ;<?noAction>| <statement?elseStatement>] ].
while_statement::=while ( <condition> ) [<statement>].
dowhile_statement::=do <statement> while ( <condition> );.
for_statement::=for ( [<variableDefinition> ; | <assignment?startAssignment> ;] <condition?endCondition> ;
<assignment?iteratorExpression> ) <statement>.
forElement_statement::=for ( <variableDefinition> : <value?forContainer> ) <statement>.
switch_statement::=switch ( <value?switchValue> )
\{ { {<?case> case <value> : } { <statement> } }
[<?default> default : { <statement> }]
\}.
try_statement::=try <statementBlock> {<?catchBlock> catch ( <typeIdent?ExceptionType> <$?exceptionVariable> )
<statementBlock> }.
statementBlock::=\{
[{ <variableDefinition?+?> ;
| <classDefinition>
| <statement>
| @SuppressWarnings(<""?>)
}] \}.
##A value represented a number, string or such one. In other way it's named 'expression'.
## But the designation 'expression' is not so precise. It means anywhat.
##A typefixValue is a value, which type isn't changed in combining with the given operators.
## The highest type of all simpleValues presents the type of the expression: int higher as short etc. Order is double
float long int short byte boolean.
## It is possible that the simpleValue is char or String. Than the order is String, char, numerical.
##Note: exclude && and || because there are activ in maybeBooleanValue. Beware the conflict with & and |.
typefixValue::= { [|<unaryOperator>] <simpleValue?> ? [? && | \|\| ] [<?binaryOperator> + | - | * | / | % | & | \| | ^
| \>\> | \<\< ] }.
##A maybeBooleanValue may be a boolean value, if a cmpOperator is present and/or a combining with booleanOperator is
found.
## Than the type of expression is boolean.
##A maybeBooleanValue may also be a typefixValue.
maybeBooleanValue::={ <typefixValue?> [ [<?cmpOperator> \>= | \<= | \> | \< | == | != ] <typefixValue?>] ?
[<?booleanOperator> && | \|\| ] }.
##A value may be a boolean or not boolean value, but a conditional operation and a assignment are also recognized.
##If a condition expression are found, the first value is the parsed value before ?. It is a boolean, because the
javac-Compiler has tested it.
## the terms left and right from : are any desired value, including conditionals and assignments.
##An assignment infers in presenting of a = operator. The left side is a variable than, the javac-Compiler has tested
it.
## Right hand from = there is any desird value, it is the repetition syntax construct. A concatenating of assignments is
accepted.
##The type of expression is the type of the left assignment, or the higher type of trueValue and falseValue, or the type
of maybeBooleanValue.
##The type of expression is used and tested, if a actual paramter for a method is given and the methods signature is
searched.
value::=
{ <maybeBooleanValue?>
[<?conditional> \? <value?trueValue> : <value?falseValue> ] ##NOTE: the value before ? is the boolean condition.
?<?assignment> <assignOperator> ##NOTE: In this case the parsed value before = is a left value, the javac-compiler had
testet it.
}
.
##A simpleValue is a component of a value not concatenated with operators.
simpleValue::=<?>
[
<""?simpleStringLiteral>[ \. <simpleMethodCall?StringLiteralMethod> ] ##StringLiteralMethod: It is a special form, in
Java "xyz". is a String Object.
| <''?simpleCharLiteral>
| [<?booleanConst>true|false]
|<?nullRef>null
|<?casting> ( <type> ) <value> ##NOTE: must be arranged before ( <simpleValue> ) because confusion with, example
(type)simpleValue and (variable)
|<?newInstanceAccess> ( new <newObject> ) \. [<simpleMethodCall> | <variable> ]
| ( <value?parenthesisExpression> )
| 0x<#x?hexNumber>[L]
| - 0x<#x?hexNumberNegative>[L]
| <#-?intNumber>[?\.][L]
| <#f?floatNumber>F
| <#f?doubleNumber>
|<?newObject> [<envIdent>] new <newObject?> [\{ <classContent?impliciteImplementationClass> \}]
| new <newArray>
|<?methodCall> [<reference>]<simpleMethodCall?>
|<?reflectionType> <$?Type> \. class
|<?variable> [ -- <?preDecrement>| ++ <?preIncrement>|][<reference>]<simpleVariable?>[ -- <?postDecrement>| ++
<?postIncrement>|]
]
.
condition::=<value?>. ##The compiler tests that it is a boolean value expression.
nullPointer::=null.
unaryOperator::=<?> [<?unaryOperator> - | ~ | ! ].
##superAccess::=super\..
##A reference is all things left from point.
reference::={[ this<?this> | super<?super> | ( new <newObject> ) | <simpleMethodCall?referenceMethod> |
<simpleVariable?referenceAssociation> ] \. }.
##A variable is either a left value or a kind of value.
simpleVariable::= <$?variableName>[{ \[ <value?arrayIndex> \] }].
simpleMethodCall::=<$?methodName> ( [<actualArguments>] ).
actualArguments::={ <value> ? , }.
##formal parameter or argument list of methods and constructors:
argumentList::=<?>{<?argument> <$?va_arg>\.\.\. <$?name> | <Modifier?> <type> <$?name>[\[\]<?array>] ?, }.
##A syntactical variableDefinition is such as "int a,b,c". But a semantical variableDefinition is "int a", "int b".
##Therefore the type is assigned to the syntactical <variableInstance?...>, this is semantical the
<...?+variableDefinition>.
variableDefinition::=<?>
[{ /**[><description?-?>*/]
| @SuppressWarnings(<""?>)
}]
[<Modifier?-?>] <type?-?> {<variableInstance?+variableDefinition> ? , }.
variableInstance::=<$?name> [ \[\]<?array> ] [ = [ new [<newObject> [\{ <classContent?impliciteImplementationClass> \}]
|<newArray>] | <constArray> | <value>] ].
newObject::= <type?className> ( [<actualArguments>] ).
newArray::= <type?className> {\[ <value> \]}.
constArray::= \{ { <simpleValue?> ? , } \}.