Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created September 15, 2017 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmizu/bb3fe4bf3589f84f2dbcdd21ddab6a94 to your computer and use it in GitHub Desktop.
Save kmizu/bb3fe4bf3589f84f2dbcdd21ddab6a94 to your computer and use it in GitHub Desktop.
プログラミング言語の構文の複雑さについて考える 〜Java vs. Scala〜 ref: http://qiita.com/kmizu/items/62db9d44f929055fbfc7
‘try’ (‘{’ Block ‘}’ | Expr) [‘catch’ ‘{’ CaseClauses ‘}’] [‘finally’ Expr]
TryStatement:
try Block Catches
| try Block [Catches] Finally
| TryWithResourcesStatement;
Catches:
CatchClause {CatchClause};
CatchClause:
catch ( CatchFormalParameter ) Block;
CatchFormalParameter:
{VariableModifier} CatchType VariableDeclaratorId;
CatchType:
UnannClassType {| ClassType};
Finally:
finally Block;
ClassDef ::= id [TypeParamClause] {ConstrAnnotation}
[AccessModifier]
ClassParamClauses ClassTemplateOpt
TraitDef ::= id [TypeParamClause] TraitTemplateOpt
ObjectDef ::= id ClassTemplateOpt
ClassTemplateOpt ::= ‘extends’ ClassTemplate | [[‘extends’] TemplateBody]
TraitTemplateOpt ::= ‘extends’ TraitTemplate | [[‘extends’] TemplateBody]
ClassTemplate ::= [EarlyDefs] ClassParents [TemplateBody]
TraitTemplate ::= [EarlyDefs] TraitParents [TemplateBody]
TypeDeclaration:
ClassDeclaration
| InterfaceDeclaration;
ClassDeclaration:
NormalClassDeclaration
| EnumDeclaration;
NormalClassDeclaration:
{ClassModifier} class Identifier [TypeParameters] [Superclass]
[Superinterfaces] ClassBody;
EnumDeclaration:
{ClassModifier} enum Identifier [Superinterfaces] EnumBody;
InterfaceDeclaration:
AnnotationTypeDeclaration
| NormalInterfaceDeclaration;
NormalInterfaceDeclaration:
{InterfaceModifier} interface Identifier [TypeParameters]
[ExtendsInterfaces] InterfaceBody;
InterfaceBody: { {InterfaceMemberDeclaration} };
InterfaceMemberDeclaration:
ConstantDeclaration
| InterfaceMethodDeclaration
| ClassDeclaration
| InterfaceDeclaration;
ClassBody: { {ClassBodyDeclaration} };
ClassBodyDeclaration:
ClassMemberDeclaration
| InstanceInitializer
| StaticInitializer
| ConstructorDeclaration;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment