case-sensitive // cause that's what Java is
= source
<sourcepart> <source> = source
! <int> = translatorcall
<translatorcall> = sourcepart
<classdecl> = sourcepart
<modifiers> class <identifier> <typeparams> = classhead
static = modifier
public = modifier
abstract = modifier
protected = modifier
final = modifier
transient = modifier
volatile = modifier
synchronized = modifier
= modifiers
<modifier> <modifiers> = modifiers
<classhead> { } = emptyclass
<emptyclass> = classdecl
<classhead> { <classbody> } = classdecl
<classbody> <classbody> = classbody
; = classbody
<vardecl> = classbody
<qid> = type
<qid> <typeparams> = type
<type> [] = type
<> = typeargs
< <typelist> > = typeargs
<typeargs> = typeargs_opt
= typeargs_opt
= typeparams
< <typeparamlist_opt> > = typeparams
= typeparamlist_opt
<typeparamlist> = typeparamlist_opt
<typeparam> = typeparamlist
<typeparam>, <typeparamlist> = typeparamlist
<type> = typeparam
<type> extends <type> = typeparam
<type> implements <type> = typeparam
<type> = typelist
<type>, <typelist> = typelist
<block> = blockorsemicolon
; = blockorsemicolon
() = argsdecl2
(<argsdecl>) = argsdecl2
= throws_opt
throws <typelist> = throws_opt
<modifiers> <type> <identifier> <argsdecl2> <throws_opt> <blockorsemicolon> = method
<modifiers> <identifier> <argsdecl2> <throws_opt> <block> = constructordecl
<modifiers> * <argsdecl2> <throws_opt> <block> = constructordecl // javax
<constructordecl> = classbody
<method> = classbody
<classdecl> = classbody // inner classes!
<identifier> = expX
<quoted> = expX
<int> = expX
-<int> = expX
// explist, args
<exp> = actualExplist
<exp>, <actualExplist> = actualExplist
<actualExplist> = explist
= explist
(<explist>) = args
// function calls - precedence?
<identifier> <args> = call
<call> = expX
// method call - precedence?
<exp>.<call> = methodcall
<methodcall> = expX
// qualified identifier
<identifier> = qid
<identifier>.<qid> = qid
<qid> = expX
// "new" expressions
new <qid> <typeargs_opt> = newexp // JavaX!
new <qid> <typeargs_opt> <args> = newexp
<newexp> = exp
// bracketing expressions - gives highest precedence
( <exp> ) = expX
// binary operators
<expX> = exp3
<exp3> = exp2
<exp2> * <exp3> = exp2
<exp2> / <exp3> = exp2
<exp2> = exp1
<exp1> + <exp2> = exp1
<exp1> - <exp2> = exp1
<exp1> = exp0
<exp1> < <exp1> = exp0
<exp1> > <exp1> = exp0
<exp1> != <exp1> = exp0
= empty // hack...
<exp1> = <empty> = <exp1> = exp0
// m1 = minus 1...
<exp0> = expm1
<exp0> ? <exp0> : <exp0> = expm1 // priority?
// casts (where in hierarchy?)
(<type>) <exp1> = exp1
<expm1> = exp
<type> <identifier> = argsdecl
<type> * <identifier> = argsdecl // javax
<argsdecl>, <argsdecl> = argsdecl
// variable declarations (both local and fields)
// simple variable declaration
<modifiers> <type> <identifier> = vardeclShort
<vardeclShort>; = <vardecl>
// same with initializer
<modifiers> <type> <identifier> = <exp> = vardeclShort
// todo: multiple decls...
<vardecl> = statement
<classdecl> = statement -- local class declared in code
// empty statement
; = statement
// if statements!
= else
else <statement> = else
if (<exp>) <statement> <else> = if
// extra rule because parser has trouble with empty classes at end of stream...
if (<exp>) <statement> = if
<if> = statement
// empty statement
; = emptyStatement
<emptyStatement> = statement
// return statement!
ret = returnKeyword
return = returnKeyword
<returnKeyword> <exp>; = return
<return> = statement
// statement list
= statements
<statement> <statements> = statements
// blocks!
{ <statements> } = block
<block> = statement
// assigments!
<exp> = <exp> = assignmentShort
<exp> += <exp> = assignmentShort
<exp> -= <exp> = assignmentShort
<exp> *= <exp> = assignmentShort
<exp> /= <exp> = assignmentShort
// etc...
<assignmentShort>; = statement
<call>; = statement
<methodcall>; = statement
<newexp>; = statement
// for! - gotta look how it is defined exactly...
= for1
<vardeclShort> = for1
<explist> = for1
<assignmentShort> = for1
<explist> = for2
for (<for1>; <for2>; <for1>) <statement> = for
<for> = statement
// foreach
for (<modifiers> <type> <identifier> : <exp>) <statement> = foreach
<foreach> = statement
// imports
import <qid>; = import
import <qid>.*; = import
import static <qid>; = import
import static <qid>.*; = import
<import> = sourcepart
// synchronized statement
synchronized(<exp>) <statement> = statement
// try / catch
catch (<vardecl>) <block> = catch
finally <block> = catches
<catch> = catches
<catch> <catches> = catches
try <block> <catches> = try
<try> = statementBegan life as a copy of #1002324
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1002329 | 
| Snippet name: | Java(X) Parsing Rules using empty classes (current) | 
| Eternal ID of this version: | #1002329/1 | 
| Text MD5: | 5dd9dfd537b7cbb49a52ee9afcd1f134 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | Document | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2016-02-01 21:54:35 | 
| Source code size: | 4889 bytes / 266 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 1021 / 1271 | 
| Referenced in: | [show references] |