4 ProfessorJ Advanced

  Program

 

=

 

Import ... Def ...

PackageDec Import ... Def ...

  PackageDec

 

=

 

package Name ; 

  Import

 

=

 

import Name ; 

import Name.* ; 

  Def

 

=

 

Class

Interface

public Class

public Interface

  Class

 

=

 

class Id {Member ...}

class Id implements Id ,Id ... {Member ...}

class Id extends Id {Member ...}

class Id extends Id implements Id ,Id ... {Member ...}

abstract class Id {Member ...}

abstract class Id implements Id ,Id ... {Member ...}

abstract class Id extends Id {Member ...}

abstract class Id extends Id implements Id ,Id ... {Member ...}

  Interface

 

=

 

interface Id {Signature ...}

interface Id extends Id ,Id ... {Signature ...}

  Signature

 

=

 

MethodReturn Id (Type Id ,...) ; 

abstract MethodReturn Id (Type Id ,...) ; 

  Member

 

=

 

Field

Modifier Field

Method

Modifier Method

Constructor

Modifier Constructor

{Statement ...}

  Modifier

 

=

 

public

private

protected

  Field

 

=

 

Type Id = Expression ; 

Type Id = ArrayInit ; 

Type Id ; 

static Type Id = Expression ; 

static Type Id = ArrayInit ; 

static Type Id ; 

  Method

 

=

 

MethodReturn Id (Type Id ,...) {Statement ...}

abstract MethodReturn Id (Type Id ,...) ; 

final MethodReturn Id (Type Id ,...) {Statement ...}

static MethodReturn Id (Type Id ,...) {Statement ...}

  MethodReturn

 

=

 

void

Type

  Constructor

 

=

 

Id (Type Id ,...) {Statement ...}

  Statement

 

=

 

Expression = Expression ; 

if (Expression) Statement else Statement

if (Expression) Statement

return Expression ; 

return ; 

{Statement ...}

while (Expression) {Statement ...}

do {Statement ...} while (Expression)

for (ForInit ForExpression ForUpdate ...) {Statement ...}

break ; 

continue ; 

super (Expression ,...) ; 

this (Expression ,...) ; 

Type Id ; 

Type Id = Expression ; 

Type Id = ArrayInit ; 

StatementExpression ; 

  StatementExpression

 

=

 

Id (Expression ,...)

Expression.Id (Expression ,...)

super.Id (Expression ,...)

Expression ++

++ Expression

Expression --

-- Expression

  ForInit

 

=

 

Type Id = Expression ; 

Type Id = ArrayInit ; 

StatementExpression ,StatementExpression ... ; 

; 

  ForExpression

 

=

 

Expression ; 

; 

  ForUpdate

 

=

 

StatementExpression

Expression = Expression

  ArrayInit

 

=

 

{ArrayInit ,...}

{Expression ,...}

  Expression

 

=

 

Expression Op Expression

- Expression

+ Expression

! Expression

++ Expression

-- Expression

Expression --

Expression ++

this

Id. (expression ,...)

Expression.Id (Expression ,...)

super.Id (Expression ,...)

Expression.Id

Expression [Expression] [Expression] ...

new Id (Expression ,...)

new Type [Expression] [Expression] ...

(Type) Expression

Expression instanceof Type

Expression ? Expression : Expression

check Expression expect Expression

check Expression expect Expression within Expression

(Expression)

Id

Number

Character

String

null

true

false

  Name

 

=

 

Id. ... Id

  Op

 

=

 

+

-

*

/

<

<=

==

>

>=

&&

||

  Type

 

=

 

Id

boolean

int

char

double

float

long

byte

short

Type []

An Id is a sequence of alphanumeric characters, _, and $.