definition

module languages/java-15/expressions/Priorities
imports languages/java-15/lexical/Identifiers languages/java-15/expressions/Main

exports
  sorts WATER WATERTOKEN WATERTOKENSTART WATERTOKENSEPARATOR WATERTOKENSTAR

  lexical syntax
    ~[A-Za-z0-9\_]                 -> WATERTOKENSTART     {recover, avoid}
    WATERTOKENSTART [A-Za-z0-9\_]* -> WATERTOKEN          
    ~[A-Za-z0-9\_\ \t\12\r\n\*]    -> WATERTOKENSEPARATOR {recover, avoid}
    "*"                            -> WATERTOKENSTAR      {recover, avoid}
    WATERTOKEN                     -> WATER               
    WATERTOKENSEPARATOR            -> WATER               
    WATERTOKENSTAR                 -> WATER               
                                   -> WATEREOF            

  lexical restrictions
    WATERTOKEN -/- [A-Za-z0-9\_]
    WATERTOKENSTAR -/- [\/]

  context-free syntax
    WATER -> LAYOUT {cons("WATER")}

  (

  sorts WATEREOF

  lexical restrictions
    WATEREOF -/- ~[]

  lexical syntax
    %% Lexical insertion recovery rules                 
                                        -> "class"      {recover, cons("INSERTION")}
                                        -> "import"     {recover, cons("INSERTION")}
                                        -> ":"          {recover, cons("INSERTION")}
                                        -> ";"          {recover, cons("INSERTION")}
                                        -> "throws"     {recover, cons("INSERTION")}
                                        -> ")"          {recover, cons("INSERTION")}
                                        -> "]"          {recover, cons("INSERTION")}
                                        -> "}"          {recover, cons("INSERTION")}
                                        -> "implements" {recover, cons("INSERTION")}
                                        -> "."          {recover, cons("INSERTION")}
                                        -> "&"          {recover, cons("INSERTION")}
                                        -> ">"          {recover, cons("INSERTION")}
                                        -> ","          {recover, cons("INSERTION")}
    "/*"                                -> INSERTSTART1 {recover}
    INSERTSTART1 CommentPart* WATEREOF  -> Comment      {cons("INSERTEND")}
    "/**"                               -> INSERTSTART0 {recover}
    INSERTSTART0 CommentPart* WATEREOF  -> Comment      {cons("INSERTEND")}

  syntax
    %% Kernel syntax insertion recovery rules                     
    "\""                                      -> INSERTOPENQUOTE1 {recover}
    INSERTOPENQUOTE1 StringPart* "\n"         -> StringLiteral    {cons("INSERTEND")}
    INSERTOPENQUOTE1 StringPart* WATEREOF     -> StringLiteral    {cons("INSERTEND")}
    "'"                                       -> INSERTOPENQUOTE0 {recover}
    INSERTOPENQUOTE0 CharContent "\n"         -> CharLiteral      {cons("INSERTEND")}
    INSERTOPENQUOTE0 CharContent WATEREOF     -> CharLiteral      {cons("INSERTEND")}

  )

  (

  context-free priorities
    Expr "." "new" TypeArgs? Id TypeArgs? "(" {Expr ","}* ")" ClassBody? -> Expr
     >
    {right:
      Expr "++" -> Expr 
      Expr "--" -> Expr 
    }

  context-free priorities
    {right:
      Expr "++" -> Expr 
      Expr "--" -> Expr 
    } >
    { "(" PrimType ")" Expr -> Expr 
      "(" RefType ")" Expr -> Expr  }

  context-free priorities
    "(" PrimType ")" Expr -> Expr  >
    {left:
      Expr "*" Expr -> Expr 
      Expr "/" Expr -> Expr 
      Expr "%" Expr -> Expr 
    }

  context-free priorities
    "(" RefType ")" Expr -> Expr  >
    { "++" Expr -> Expr 
      "--" Expr -> Expr 
      "+" Expr -> Expr 
      "-" Expr -> Expr  }

  context-free priorities
    { Expr ArraySubscript -> ArrayAccess 
      Expr "." Id -> FieldAccess 
      Expr "." TypeArgs? Id -> MethodSpec  } >
    {right:
      Expr "++" -> Expr 
      Expr "--" -> Expr 
    } >
    { "++" Expr -> Expr 
      "--" Expr -> Expr 
      "+" Expr -> Expr 
      "-" Expr -> Expr 
      "~" Expr -> Expr 
      "!" Expr -> Expr  } >
    {left:
      Expr "*" Expr -> Expr 
      Expr "/" Expr -> Expr 
      Expr "%" Expr -> Expr 
    } >
    {left:
      Expr "+" Expr -> Expr 
      Expr "-" Expr -> Expr 
    } >
    {left:
      Expr "<<" Expr -> Expr 
      Expr ">>" Expr -> Expr 
      Expr ">>>" Expr -> Expr 
    } >
    {left:
      Expr "instanceof" RefType -> Expr 
      Expr "<" Expr -> Expr 
      Expr ">" Expr -> Expr 
      Expr "<=" Expr -> Expr 
      Expr ">=" Expr -> Expr 
    } >
    {left:
      Expr "==" Expr -> Expr 
      Expr "!=" Expr -> Expr 
    } >
    Expr "&" Expr -> Expr  >
    Expr "^" Expr -> Expr  >
    Expr "|" Expr -> Expr  >
    Expr "&&" Expr -> Expr  >
    Expr "||" Expr -> Expr  >
    Expr CondMid Expr -> Expr  >
    {right:
      LHS "=" Expr -> Expr 
      LHS "*=" Expr -> Expr 
      LHS "/=" Expr -> Expr 
      LHS "%=" Expr -> Expr 
      LHS "+=" Expr -> Expr 
      LHS "-=" Expr -> Expr 
      LHS "<<=" Expr -> Expr 
      LHS ">>=" Expr -> Expr 
      LHS ">>>=" Expr -> Expr 
      LHS "&=" Expr -> Expr 
      LHS "^=" Expr -> Expr 
      LHS "|=" Expr -> Expr 
    }

  )

module languages/java-15/expressions/Restrictions
exports
  lexical restrictions
    "+" -/- [\+]
    "-" -/- [\-]
    "/" -/- [\/]

module languages/java-15/expressions/AssignmentOperators
imports languages/java-15/expressions/Main

exports
  sorts LHS

  context-free syntax
    LHS "=" Expr    -> Expr {cons("Assign")}
    LHS "*=" Expr   -> Expr {cons("AssignMul")}
    LHS "/=" Expr   -> Expr {cons("AssignDiv")}
    LHS "%=" Expr   -> Expr {cons("AssignRemain")}
    LHS "+=" Expr   -> Expr {cons("AssignPlus")}
    LHS "-=" Expr   -> Expr {cons("AssignMinus")}
    LHS "<<=" Expr  -> Expr {cons("AssignLeftShift")}
    LHS ">>=" Expr  -> Expr {cons("AssignRightShift")}
    LHS ">>>=" Expr -> Expr {cons("AssignURightShift")}
    LHS "&=" Expr   -> Expr {cons("AssignAnd")}
    LHS "^=" Expr   -> Expr {cons("AssignExcOr")}
    LHS "|=" Expr   -> Expr {cons("AssignOr")}
    ExprName        -> LHS  
    FieldAccess     -> LHS  
    ArrayAccess     -> LHS  

module languages/java-15/expressions/BinaryOperators
imports languages/java-15/expressions/Main languages/java-15/types/Main

exports
  sorts CondMid

  context-free syntax
    Expr "instanceof" RefType -> Expr    {cons("InstanceOf")}
    Expr "*" Expr             -> Expr    {left, cons("Mul")}
    Expr "/" Expr             -> Expr    {left, cons("Div")}
    Expr "%" Expr             -> Expr    {left, cons("Remain")}
    Expr "+" Expr             -> Expr    {left, cons("Plus")}
    Expr "-" Expr             -> Expr    {left, cons("Minus")}
    Expr "<<" Expr            -> Expr    {left, cons("LeftShift")}
    Expr ">>" Expr            -> Expr    {left, cons("RightShift")}
    Expr ">>>" Expr           -> Expr    {left, cons("URightShift")}
    Expr "<" Expr             -> Expr    {left, cons("Lt")}
    Expr ">" Expr             -> Expr    {left, cons("Gt")}
    Expr "<=" Expr            -> Expr    {left, cons("LtEq")}
    Expr ">=" Expr            -> Expr    {left, cons("GtEq")}
    Expr "==" Expr            -> Expr    {left, cons("Eq")}
    Expr "!=" Expr            -> Expr    {left, cons("NotEq")}
    Expr "&&" Expr            -> Expr    {left, cons("LazyAnd")}
    Expr "||" Expr            -> Expr    {left, cons("LazyOr")}
    Expr "&" Expr             -> Expr    {left, cons("And")}
    Expr "^" Expr             -> Expr    {left, cons("ExcOr")}
    Expr "|" Expr             -> Expr    {left, cons("Or")}
    Expr CondMid Expr         -> Expr    {right, cons("Cond")}
    "?" Expr ":"              -> CondMid {bracket}

module languages/java-15/expressions/UnaryOperators
imports languages/java-15/expressions/Main

exports
  context-free syntax
    "+" Expr              -> Expr {cons("Plus")}
    "-" Expr              -> Expr {cons("Minus")}
    "++" Expr             -> Expr {cons("PreIncr")}
    "--" Expr             -> Expr {cons("PreDecr")}
    "~" Expr              -> Expr {cons("Complement")}
    "!" Expr              -> Expr {cons("Not")}
    "(" PrimType ")" Expr -> Expr {cons("CastPrim")}
    "(" RefType ")" Expr  -> Expr {cons("CastRef")}

module languages/java-15/expressions/Postfix
imports languages/java-15/expressions/Main

exports
  context-free syntax
    ExprName  -> Expr 
    Expr "++" -> Expr {cons("PostIncr")}
    Expr "--" -> Expr {cons("PostDecr")}

module languages/java-15/expressions/MethodInvocation
imports languages/java-15/expressions/Main

exports
  sorts MethodSpec

  context-free syntax
    MethodSpec "(" {Expr ","}* ")"        -> Expr       {cons("Invoke")}
    MethodName                            -> MethodSpec {cons("Method")}
    Expr "." TypeArgs? Id                 -> MethodSpec {cons("Method")}
    "super" "." TypeArgs? Id              -> MethodSpec {cons("SuperMethod")}
    TypeName "." "super" "." TypeArgs? Id -> MethodSpec {cons("QSuperMethod")}
    AmbName "." TypeArgs Id               -> MethodSpec {cons("GenericMethod")}

  context-free priorities
    Expr "." TypeArgs? Id -> MethodSpec  >
    ExprName -> Expr 

module languages/java-15/expressions/ArrayAccess
imports languages/java-15/expressions/Main

exports
  sorts ArrayAccess ArraySubscript

  context-free syntax
    ArrayAccess                      -> Expr           
    Expr ArraySubscript              -> ArrayAccess    {cons("ArrayAccess")}
    "[" Expr "]"                     -> ArraySubscript {bracket}
    ArrayCreationExpr ArraySubscript -> ArrayAccess    {reject}

module languages/java-15/expressions/FieldAccess
imports languages/java-15/expressions/Main

exports
  sorts FieldAccess

  context-free syntax
    FieldAccess -> Expr 

  context-free syntax
    Expr "." Id                 -> FieldAccess {cons("Field")}
    ExprName "." Id             -> FieldAccess {reject}
    "super" "." Id              -> FieldAccess {cons("SuperField")}
    TypeName "." "super" "." Id -> FieldAccess {cons("QSuperField")}

module languages/java-15/expressions/ArrayCreation
imports languages/java-15/expressions/Main

exports
  sorts ArrayCreationExpr ArrayBaseType Dim DimExpr

  context-free syntax
    ArrayCreationExpr                  -> Expr              
    "new" ArrayBaseType DimExpr+ Dim*  -> ArrayCreationExpr {cons("NewArray")}
    "new" ArrayBaseType Dim+ ArrayInit -> ArrayCreationExpr {cons("NewArray")}
    PrimType                           -> ArrayBaseType     
    TypeName                           -> ArrayBaseType     
    TypeName "<" "?" ">"               -> ArrayBaseType     {cons("UnboundWld")}
    "[" Expr "]"                       -> DimExpr           {cons("Dim")}
    "[" "]"                            -> Dim               {cons("Dim")}

module languages/java-15/expressions/ClassInstanceCreation
imports languages/java-15/expressions/Main
        languages/java-15/classes/ClassDeclarations

exports
  context-free syntax
    "new" TypeArgs? ClassOrInterfaceType "(" {Expr ","}* ")" ClassBody?  -> Expr {cons("NewInstance")}
    Expr "." "new" TypeArgs? Id TypeArgs? "(" {Expr ","}* ")" ClassBody? -> Expr {cons("QNewInstance")}

module languages/java-15/expressions/Primary
imports languages/java-15/lexical/literals/Main languages/java-15/names/Main
        languages/java-15/expressions/Main

exports
  sorts Literal

  context-free syntax
    Literal       -> Expr    {cons("Lit")}
    IntLiteral    -> Literal 
    FloatLiteral  -> Literal 
    BoolLiteral   -> Literal 
    CharLiteral   -> Literal 
    StringLiteral -> Literal 
    NullLiteral   -> Literal 

  sorts ClassLiteral

  context-free syntax
    ClassLiteral       -> Literal      
    Type "." "class"   -> ClassLiteral {cons("Class")}
    "void" "." "class" -> ClassLiteral {cons("VoidClass")}

  context-free syntax
    "this"              -> Expr {cons("This")}
    TypeName "." "this" -> Expr {cons("QThis")}

  context-free syntax
    "(" Expr ")" -> Expr {bracket}

module languages/java-15/expressions/Main
imports languages/java-15/expressions/Primary
        languages/java-15/expressions/ClassInstanceCreation
        languages/java-15/expressions/ArrayCreation
        languages/java-15/expressions/FieldAccess
        languages/java-15/expressions/ArrayAccess
        languages/java-15/expressions/MethodInvocation
        languages/java-15/expressions/Postfix
        languages/java-15/expressions/UnaryOperators
        languages/java-15/expressions/BinaryOperators
        languages/java-15/expressions/AssignmentOperators
        languages/java-15/expressions/Restrictions
        languages/java-15/expressions/Priorities

exports
  sorts Expr

module languages/java-15/statements/Main
imports languages/java-15/statements/Blocks
        languages/java-15/statements/LocalVariableDeclarations
        languages/java-15/statements/Statements

module languages/java-15/arrays/Main
imports languages/java-15/arrays/ArrayInitializers

module languages/java-15/interfaces/Main
imports languages/java-15/interfaces/InterfaceDeclarations
        languages/java-15/interfaces/AbstractMethodDeclarations
        languages/java-15/interfaces/AnnotationTypes
        languages/java-15/interfaces/Annotations

module languages/java-15/classes/Main
imports languages/java-15/classes/ClassDeclarations
        languages/java-15/classes/EnumDeclarations

module languages/java-15/packages/PackageDeclarations
imports languages/java-15/names/Main languages/java-15/interfaces/Annotations

exports
  sorts PackageDec

  context-free syntax
    Anno* "package" PackageName ";" -> PackageDec {cons("PackageDec")}

module languages/java-15/packages/ImportDeclarations
imports languages/java-15/lexical/Identifiers languages/java-15/names/Main

exports
  sorts ImportDec

  context-free syntax
    "import" TypeName ";"                  -> ImportDec {cons("TypeImportDec")}
    "import" PackageName "." "*" ";"       -> ImportDec {cons("TypeImportOnDemandDec")}
    "import" "static" TypeName "." Id ";"  -> ImportDec {cons("StaticImportDec")}
    "import" "static" TypeName "." "*" ";" -> ImportDec {cons("StaticImportOnDemandDec")}

module languages/java-15/interfaces/AnnotationTypes
imports languages/java-15/lexical/Identifiers
        languages/java-15/classes/ClassDeclarations
        languages/java-15/classes/EnumDeclarations
        languages/java-15/interfaces/InterfaceDeclarations
        languages/java-15/interfaces/AbstractMethodDeclarations
        languages/java-15/interfaces/ConstantDeclarations
        languages/java-15/interfaces/Annotations

exports
  sorts AnnoDec AnnoDecHead

  context-free syntax
    AnnoDecHead "{" AnnoElemDec* "}"            -> AnnoDec     {cons("AnnoDec")}
    ( Anno | InterfaceMod )* "@" "interface" Id -> AnnoDecHead {cons("AnnoDecHead")}

  sorts AnnoElemDec DefaultVal

  context-free syntax
    AbstractMethodMod* Type Id "(" ")" DefaultVal? ";" -> AnnoElemDec {cons("AnnoMethodDec")}
    ConstantDec                                        -> AnnoElemDec 
    ClassDec                                           -> AnnoElemDec 
    InterfaceDec                                       -> AnnoElemDec 
    EnumDec                                            -> AnnoElemDec 
    AnnoDec                                            -> AnnoElemDec 
    ";"                                                -> AnnoElemDec {cons("Semicolon")}
    "default" ElemVal                                  -> DefaultVal  {cons("DefaultVal")}

module languages/java-15/interfaces/AbstractMethodDeclarations
imports languages/java-15/lexical/Modifiers languages/java-15/names/Main
        languages/java-15/types/Main
        languages/java-15/classes/MethodDeclarations

exports
  sorts AbstractMethodDec AbstractMethodMod

  context-free syntax
    ( Anno | AbstractMethodMod )* TypeParams? ResultType Id "(" {FormalParam ","}* ")" Throws? ";"      -> AbstractMethodDec {cons("AbstractMethodDec")}
    ( Anno | AbstractMethodMod )* TypeParams? ResultType Id "(" {FormalParam ","}* ")" Dim+ Throws? ";" -> AbstractMethodDec {cons("DeprAbstractMethodDec")}
    Public                                                                                              -> AbstractMethodMod 
    Abstract                                                                                            -> AbstractMethodMod 

module languages/java-15/interfaces/ConstantDeclarations
imports languages/java-15/lexical/Modifiers languages/java-15/types/Main
        languages/java-15/classes/MethodDeclarations
        languages/java-15/interfaces/Annotations

exports
  sorts ConstantDec ConstantMod

  context-free syntax
    ( Anno | ConstantMod )* Type {VarDec ","}+ ";" -> ConstantDec {cons("ConstantDec")}
    Public                                         -> ConstantMod 
    Static                                         -> ConstantMod 
    Final                                          -> ConstantMod 

module languages/java-15/interfaces/InterfaceDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/lexical/Modifiers languages/java-15/names/Main
        languages/java-15/types/Main languages/java-15/classes/ClassDeclarations
        languages/java-15/classes/MethodDeclarations
        languages/java-15/interfaces/ConstantDeclarations
        languages/java-15/interfaces/AbstractMethodDeclarations
        languages/java-15/interfaces/AnnotationTypes
        languages/java-15/interfaces/Annotations

exports
  sorts InterfaceDec InterfaceDecHead ExtendsInterfaces InterfaceMemberDec
        InterfaceMod

  context-free syntax
    AnnoDec                                                                -> InterfaceDec      
    InterfaceDecHead "{" InterfaceMemberDec* "}"                           -> InterfaceDec      {cons("InterfaceDec")}
    ( Anno | InterfaceMod )* "interface" Id TypeParams? ExtendsInterfaces? -> InterfaceDecHead  {cons("InterfaceDecHead")}
    "extends" {InterfaceType ","}+                                         -> ExtendsInterfaces {cons("ExtendsInterfaces")}

  context-free syntax
    ConstantDec       -> InterfaceMemberDec 
    AbstractMethodDec -> InterfaceMemberDec 
    ClassDec          -> InterfaceMemberDec 
    InterfaceDec      -> InterfaceMemberDec 
    ";"               -> InterfaceMemberDec {cons("Semicolon")}

  context-free syntax
    Public    -> InterfaceMod 
    Protected -> InterfaceMod 
    Private   -> InterfaceMod 
    Abstract  -> InterfaceMod 
    Static    -> InterfaceMod 
    StrictFP  -> InterfaceMod 

module languages/java-15/classes/EnumDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/classes/ClassDeclarations

exports
  sorts EnumDec EnumDecHead EnumBody EnumConst EnumConstArgs EnumBodyDecs

  context-free syntax
    EnumDecHead EnumBody                       -> EnumDec       {cons("EnumDec")}
    ( Anno | ClassMod )* "enum" Id Interfaces? -> EnumDecHead   {cons("EnumDecHead")}
    "{" {EnumConst ","}* EnumBodyDecs? "}"     -> EnumBody      {cons("EnumBody")}
    "{" {EnumConst ","}* "," EnumBodyDecs? "}" -> EnumBody      {cons("EnumBody")}
    Id EnumConstArgs? ClassBody?               -> EnumConst     {cons("EnumConst")}
    "(" {Expr ","}* ")"                        -> EnumConstArgs {bracket}
    ";" ClassBodyDec*                          -> EnumBodyDecs  {cons("EnumBodyDecs")}

module languages/java-15/classes/ConstructorDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/lexical/Modifiers
        languages/java-15/interfaces/Annotations
        languages/java-15/statements/Main languages/java-15/expressions/Main

exports
  sorts ConstrDec ConstrBody ConstrHead ConstrInv

  context-free syntax
    ConstrHead ConstrBody                                                   -> ConstrDec  {cons("ConstrDec")}
    ( Anno | ConstrMod )* TypeParams? Id "(" {FormalParam ","}* ")" Throws? -> ConstrHead {cons("ConstrDecHead")}
    "{" ConstrInv? BlockStm* "}"                                            -> ConstrBody {cons("ConstrBody")}
    TypeArgs? "this" "(" {Expr ","}* ")" ";"                                -> ConstrInv  {cons("AltConstrInv")}
    TypeArgs? "super" "(" {Expr ","}* ")" ";"                               -> ConstrInv  {cons("SuperConstrInv")}
    Expr "." TypeArgs? "super" "(" {Expr ","}* ")" ";"                      -> ConstrInv  {cons("QSuperConstrInv")}

  sorts ConstrMod

  context-free syntax
    Public    -> ConstrMod 
    Protected -> ConstrMod 
    Private   -> ConstrMod 

module languages/java-15/classes/StaticInitializers
imports languages/java-15/statements/Blocks

exports
  sorts StaticInit

  context-free syntax
    "static" Block -> StaticInit {cons("StaticInit")}

module languages/java-15/classes/InstanceInitializers
imports languages/java-15/statements/Blocks

exports
  sorts InstanceInit

  context-free syntax
    Block -> InstanceInit {cons("InstanceInit")}

module languages/java-15/statements/Statements
imports languages/java-15/statements/LocalVariableDeclarations
        languages/java-15/statements/Blocks languages/java-15/expressions/Main

exports
  sorts Stm

  context-free syntax
    Block -> Stm 

  context-free syntax
    ";" -> Stm {cons("Empty")}

  context-free syntax
    Id ":" Stm -> Stm {cons("Labeled")}

  context-free syntax
    Expr ";" -> Stm {cons("ExprStm")}

  context-free syntax
    "if" "(" Expr ")" Stm            -> Stm {prefer, cons("If")}
    "if" "(" Expr ")" Stm "else" Stm -> Stm {cons("If")}

  context-free syntax
    "assert" Expr ";"          -> Stm {cons("AssertStm")}
    "assert" Expr ":" Expr ";" -> Stm {cons("AssertStm")}

  sorts SwitchBlock SwitchGroup SwitchLabel

  context-free syntax
    "switch" "(" Expr ")" SwitchBlock -> Stm         {cons("Switch")}
    "{" SwitchGroup* SwitchLabel* "}" -> SwitchBlock {cons("SwitchBlock")}
    SwitchLabel+ BlockStm+            -> SwitchGroup {cons("SwitchGroup")}
    "case" Expr ":"                   -> SwitchLabel {cons("Case")}
    "default" ":"                     -> SwitchLabel {cons("Default")}

  context-free syntax
    "while" "(" Expr ")" Stm -> Stm {cons("While")}

  context-free syntax
    "do" Stm "while" "(" Expr ")" ";" -> Stm {cons("DoWhile")}

  context-free syntax
    "for" "(" LocalVarDec ";" Expr? ";" {Expr ","}* ")" Stm -> Stm {cons("For")}
    "for" "(" {Expr ","}* ";" Expr? ";" {Expr ","}* ")" Stm -> Stm {cons("For")}
    "for" "(" FormalParam ":" Expr ")" Stm                  -> Stm {cons("ForEach")}

  context-free syntax
    "break" Id? ";" -> Stm {cons("Break")}

  context-free syntax
    "continue" Id? ";" -> Stm {cons("Continue")}

  context-free syntax
    "return" Expr? ";" -> Stm {cons("Return")}

  context-free syntax
    "throw" Expr ";" -> Stm {cons("Throw")}

  context-free syntax
    "synchronized" "(" Expr ")" Block -> Stm {cons("Synchronized")}

  sorts CatchClause

  context-free syntax
    "try" Block CatchClause+                 -> Stm         {cons("Try")}
    "try" Block CatchClause* "finally" Block -> Stm         {cons("Try")}
    "catch" "(" FormalParam ")" Block        -> CatchClause {cons("Catch")}

module languages/java-15/statements/LocalVariableDeclarations
imports languages/java-15/classes/MethodDeclarations
        languages/java-15/classes/FieldDeclarations

exports
  sorts LocalVarDecStm LocalVarDec

  context-free syntax
    LocalVarDec ";"                       -> LocalVarDecStm {prefer, cons("LocalVarDecStm")}
    ( Anno | VarMod )* Type {VarDec ","}+ -> LocalVarDec    {prefer, cons("LocalVarDec")}

module languages/java-15/statements/Blocks
imports languages/java-15/classes/ClassDeclarations
        languages/java-15/statements/LocalVariableDeclarations
        languages/java-15/statements/Statements

exports
  sorts BlockStm Block

  context-free syntax
    "{" BlockStm* "}" -> Block    {cons("Block")}
    LocalVarDecStm    -> BlockStm 
    ClassDec          -> BlockStm {cons("ClassDecStm")}
    Stm               -> BlockStm 

module languages/java-15/classes/MethodDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/lexical/Modifiers languages/java-15/types/Main
        languages/java-15/classes/FieldDeclarations
        languages/java-15/interfaces/Annotations
        languages/java-15/statements/Blocks

exports
  sorts MethodDec MethodDecHead ResultType

  context-free syntax
    MethodDecHead MethodBody                                                                -> MethodDec     {cons("MethodDec")}
    ( Anno | MethodMod )* TypeParams? ResultType Id "(" {FormalParam ","}* ")" Throws?      -> MethodDecHead {cons("MethodDecHead")}
    ( Anno | MethodMod )* TypeParams? ResultType Id "(" {FormalParam ","}* ")" Dim+ Throws? -> MethodDecHead {cons("DeprMethodDecHead")}
    Type                                                                                    -> ResultType    
    "void"                                                                                  -> ResultType    {cons("Void")}

  sorts FormalParam

  context-free syntax
    ( Anno | VarMod )* Type VarDecId       -> FormalParam {cons("Param")}
    ( Anno | VarMod )* Type "..." VarDecId -> FormalParam {cons("VarArityParam")}

  sorts VarMod

  context-free syntax
    Final -> VarMod 

  sorts MethodMod

  context-free syntax
    Public       -> MethodMod 
    Protected    -> MethodMod 
    Private      -> MethodMod 
    Abstract     -> MethodMod 
    Static       -> MethodMod 
    Final        -> MethodMod 
    Synchronized -> MethodMod 
    Native       -> MethodMod 
    StrictFP     -> MethodMod 

  sorts Throws ExceptionType

  context-free syntax
    "throws" {ExceptionType ","}+ -> Throws        {cons("ThrowsDec")}
    ClassType                     -> ExceptionType 

  sorts MethodBody

  context-free syntax
    Block -> MethodBody 
    ";"   -> MethodBody {cons("NoMethodBody")}

module languages/java-15/arrays/ArrayInitializers
imports languages/java-15/classes/FieldDeclarations

exports
  sorts ArrayInit

  context-free syntax
    "{" {VarInit ","}* "}"     -> ArrayInit {cons("ArrayInit")}
    "{" {VarInit ","}* "," "}" -> ArrayInit {cons("ArrayInit")}

module languages/java-15/interfaces/Annotations
imports languages/java-15/lexical/Identifiers languages/java-15/names/Main
        languages/java-15/expressions/Main

exports
  sorts Anno ElemVal ElemValPair

  context-free syntax
    "@" TypeName "(" {ElemValPair ","}* ")" -> Anno {cons("Anno")}
    "@" TypeName "(" ElemVal ")"            -> Anno {cons("SingleElemAnno")}
    "@" TypeName                            -> Anno {cons("MarkerAnno")}

  context-free syntax
    Id "=" ElemVal             -> ElemValPair {cons("ElemValPair")}
    Expr                       -> ElemVal     
    Anno                       -> ElemVal     
    "{" {ElemVal ","}* "}"     -> ElemVal     {cons("ElemValArrayInit")}
    "{" {ElemVal ","}* "," "}" -> ElemVal     {cons("ElemValArrayInit")}
    LHS "=" Expr               -> ElemVal     {reject}

module languages/java-15/classes/FieldDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/lexical/Modifiers languages/java-15/types/Main
        languages/java-15/interfaces/Annotations
        languages/java-15/arrays/ArrayInitializers
        languages/java-15/expressions/Main

exports
  sorts FieldDec VarDec VarDecId Dim VarInit

  context-free syntax
    ( Anno | FieldMod )* Type {VarDec ","}+ ";" -> FieldDec {cons("FieldDec")}
    VarDecId                                    -> VarDec   {cons("VarDec")}
    VarDecId "=" VarInit                        -> VarDec   {cons("VarDec")}
    Id                                          -> VarDecId 
    Id Dim+                                     -> VarDecId {cons("ArrayVarDecId")}
    "[" "]"                                     -> Dim      {cons("Dim")}
    Expr                                        -> VarInit  
    ArrayInit                                   -> VarInit  

  sorts FieldMod

  context-free syntax
    Public    -> FieldMod 
    Protected -> FieldMod 
    Private   -> FieldMod 
    Static    -> FieldMod 
    Final     -> FieldMod 
    Transient -> FieldMod 
    Volatile  -> FieldMod 

module languages/java-15/classes/ClassDeclarations
imports languages/java-15/lexical/Identifiers
        languages/java-15/lexical/Modifiers
        languages/java-15/types/ReferenceTypes
        languages/java-15/types/TypeVariables
        languages/java-15/classes/FieldDeclarations
        languages/java-15/classes/MethodDeclarations
        languages/java-15/classes/InstanceInitializers
        languages/java-15/classes/StaticInitializers
        languages/java-15/classes/ConstructorDeclarations
        languages/java-15/classes/EnumDeclarations
        languages/java-15/interfaces/InterfaceDeclarations

exports
  sorts ClassDec ClassBody ClassDecHead

  context-free syntax
    EnumDec                                                        -> ClassDec     
    ClassDecHead ClassBody                                         -> ClassDec     {cons("ClassDec")}
    "{" ClassBodyDec* "}"                                          -> ClassBody    {cons("ClassBody")}
    ( Anno | ClassMod )* "class" Id TypeParams? Super? Interfaces? -> ClassDecHead {cons("ClassDecHead")}

  sorts ClassMod

  context-free syntax
    Abstract  -> ClassMod 
    Public    -> ClassMod 
    Protected -> ClassMod 
    Private   -> ClassMod 
    Static    -> ClassMod 
    Final     -> ClassMod 
    StrictFP  -> ClassMod 

  sorts Super

  context-free syntax
    "extends" ClassType -> Super {cons("SuperDec")}

  sorts Interfaces

  context-free syntax
    "implements" {InterfaceType ","}+ -> Interfaces {cons("ImplementsDec")}

  sorts ClassBodyDec ClassMemberDec

  context-free syntax
    ClassMemberDec -> ClassBodyDec 
    InstanceInit   -> ClassBodyDec 
    StaticInit     -> ClassBodyDec 
    ConstrDec      -> ClassBodyDec 

  context-free syntax
    FieldDec     -> ClassMemberDec 
    MethodDec    -> ClassMemberDec 
    ClassDec     -> ClassMemberDec 
    InterfaceDec -> ClassMemberDec 
    ";"          -> ClassMemberDec {cons("Semicolon")}

module languages/java-15/packages/TypeDeclarations
imports languages/java-15/classes/ClassDeclarations
        languages/java-15/interfaces/InterfaceDeclarations

exports
  sorts TypeDec

  context-free syntax
    ClassDec     -> TypeDec 
    InterfaceDec -> TypeDec 
    ";"          -> TypeDec {cons("Semicolon")}

module languages/java-15/packages/CompilationUnits
imports languages/java-15/packages/PackageDeclarations
        languages/java-15/packages/ImportDeclarations
        languages/java-15/packages/TypeDeclarations

exports
  sorts CompilationUnit

  context-free syntax
    PackageDec? ImportDec* TypeDec+ -> CompilationUnit {cons("CompilationUnit")}

module languages/java-15/packages/Main
imports languages/java-15/packages/CompilationUnits
        languages/java-15/packages/ImportDeclarations
        languages/java-15/packages/PackageDeclarations

module languages/java-15/names/Main
imports languages/java-15/lexical/Identifiers

exports
  sorts PackageName

  context-free syntax
    {Id "."}+ -> PackageName {cons("PackageName")}

  sorts TypeName ExprName MethodName PackageOrTypeName AmbName

  context-free syntax
    Id                       -> AmbName           {cons("AmbName")}
    AmbName "." Id           -> AmbName           {cons("AmbName")}
    Id                       -> TypeName          {cons("TypeName")}
    PackageOrTypeName "." Id -> TypeName          {cons("TypeName")}
    Id                       -> ExprName          {cons("ExprName")}
    AmbName "." Id           -> ExprName          {cons("ExprName")}
    Id                       -> MethodName        {cons("MethodName")}
    AmbName "." Id           -> MethodName        {cons("MethodName")}
    Id                       -> PackageOrTypeName {cons("PackageOrTypeName")}
    PackageOrTypeName "." Id -> PackageOrTypeName {cons("PackageOrTypeName")}

module languages/java-15/types/ParameterizedTypes
imports languages/java-15/types/ReferenceTypes

exports
  sorts TypeArgs ActualTypeArg WildcardBound

  context-free syntax
    "<" {ActualTypeArg ","}+ ">" -> TypeArgs      {cons("TypeArgs")}
    Type                         -> ActualTypeArg 
    "?" WildcardBound?           -> ActualTypeArg {cons("Wildcard")}
    "extends" RefType            -> WildcardBound {cons("WildcardUpperBound")}
    "super" RefType              -> WildcardBound {cons("WildcardLowerBound")}

module languages/java-15/types/TypeVariables
imports languages/java-15/lexical/Identifiers
        languages/java-15/types/ReferenceTypes

exports
  sorts TypeParams TypeParam TypeBound TypeVarId

  context-free syntax
    TypeVarId TypeBound?                  -> TypeParam  {cons("TypeParam")}
    "extends" {ClassOrInterfaceType "&"}+ -> TypeBound  {cons("TypeBound")}
    "<" {TypeParam ","}+ ">"              -> TypeParams {cons("TypeParams")}
    Id                                    -> TypeVarId  

module languages/java-15/types/ReferenceTypes
imports languages/java-15/lexical/Identifiers languages/java-15/names/Main
        languages/java-15/types/Main languages/java-15/types/ParameterizedTypes
        languages/java-15/types/TypeVariables

exports
  sorts RefType ClassOrInterfaceType ClassType InterfaceType TypeDecSpec
        ArrayType TypeVar

  context-free syntax
    ClassOrInterfaceType -> RefType 
    ArrayType            -> RefType 

  context-free syntax
    TypeDecSpec TypeArgs?       -> ClassOrInterfaceType {cons("ClassOrInterfaceType")}
    TypeDecSpec TypeArgs?       -> ClassType            {cons("ClassType")}
    TypeDecSpec TypeArgs?       -> InterfaceType        {cons("InterfaceType")}
    TypeName                    -> TypeDecSpec          
    TypeDecSpec TypeArgs "." Id -> TypeDecSpec          {cons("Member")}

  context-free syntax
    TypeVarId -> TypeVar {cons("TypeVar")}

  context-free syntax
    Type "[" "]" -> ArrayType {cons("ArrayType")}

module languages/java-15/types/PrimitiveTypes
exports
  sorts PrimType NumType IntType FloatType

  context-free syntax
    NumType   -> PrimType  
    "boolean" -> PrimType  {cons("Boolean")}
    IntType   -> NumType   
    FloatType -> NumType   
    "byte"    -> IntType   {cons("Byte")}
    "short"   -> IntType   {cons("Short")}
    "int"     -> IntType   {cons("Int")}
    "long"    -> IntType   {cons("Long")}
    "char"    -> IntType   {cons("Char")}
    "float"   -> FloatType {cons("Float")}
    "double"  -> FloatType {cons("Double")}

module languages/java-15/types/Main
imports languages/java-15/types/PrimitiveTypes
        languages/java-15/types/ReferenceTypes
        languages/java-15/types/TypeVariables
        languages/java-15/types/ParameterizedTypes

exports
  sorts Type

  context-free syntax
    PrimType -> Type 
    RefType  -> Type 

module languages/java-15/lexical/literals/NullLiteral
exports
  sorts NullLiteral

  context-free syntax
    "null" -> NullLiteral {cons("Null")}

module languages/java-15/lexical/literals/StringLiterals
imports languages/java-15/lexical/literals/EscapeSequences
        languages/java-15/lexical/UnicodeEscapes

exports
  sorts StringLiteral StringPart StringChars FooStringChars

  syntax
    StringLiteral         -> <StringLiteral-CF>   
    "\"" StringPart* "\"" -> StringLiteral        {cons("String")}
    StringChars           -> StringPart           {cons("Chars")}
    UnicodeEscape         -> StringPart           
    EscapeSeq             -> StringPart           
    <FooStringChars-LEX>  -> StringChars          
    ~[\"\\\n\13]+         -> <FooStringChars-LEX> 

  restrictions
    StringChars -/- ~[\"\\\n\13]

module languages/java-15/lexical/literals/EscapeSequences
imports 

exports
  sorts EscapeSeq NamedEscape OctaEscape LastOcta

  syntax
    OctaEscape             -> EscapeSeq   
    NamedEscape            -> EscapeSeq   
    "\\" [btnfr\"\'\\]     -> NamedEscape {cons("NamedEscape")}
    "\\" LastOcta          -> OctaEscape  {cons("OctaEscape1")}
    "\\" [0-3] LastOcta    -> OctaEscape  {cons("OctaEscape2")}
    "\\" [4-7] [0-7]       -> OctaEscape  {cons("OctaEscape2")}
    "\\" [0-3] [0-7] [0-7] -> OctaEscape  {cons("OctaEscape3")}
    [0-7]                  -> LastOcta    

  restrictions
    LastOcta -/- [0-7]

module languages/java-15/lexical/literals/CharacterLiterals
imports languages/java-15/lexical/literals/EscapeSequences
        languages/java-15/lexical/UnicodeEscapes

exports
  sorts CharLiteral CharContent SingleChar

  syntax
    CharLiteral         -> <CharLiteral-CF> 
    "'" CharContent "'" -> CharLiteral      {cons("Char")}
    SingleChar          -> CharContent      {cons("Single")}
    UnicodeEscape       -> CharContent      
    EscapeSeq           -> CharContent      
    ~[\r\n\'\\]         -> SingleChar       

module languages/java-15/lexical/literals/BooleanLiterals
exports
  sorts Bool BoolLiteral

  context-free syntax
    Bool    -> BoolLiteral {cons("Bool")}
    "true"  -> Bool        {cons("True")}
    "false" -> Bool        {cons("False")}

module languages/java-15/lexical/literals/FloatingPointLiterals
exports
  sorts FloatLiteral DeciFloatLiteral HexaFloatLiteral

  context-free syntax
    DeciFloatLiteral -> FloatLiteral {cons("Float")}
    HexaFloatLiteral -> FloatLiteral {cons("Float")}

  lexical syntax
    DeciFloatNumeral [fFdD]? -> DeciFloatLiteral 
    HexaFloatNumeral [fFdD]? -> HexaFloatLiteral 
    [0-9]+                   -> DeciFloatLiteral {reject}

  lexical restrictions
    DeciFloatLiteral -/- [fFdD]
    HexaFloatLiteral -/- [fFdD]

  sorts DeciFloatNumeral DeciFloatDigits DeciFloatExponentPart

  lexical syntax
    DeciFloatDigits DeciFloatExponentPart? -> DeciFloatNumeral      
    [0-9]* "." [0-9]*                      -> DeciFloatDigits       
    "."                                    -> DeciFloatDigits       {reject}
    [0-9]+                                 -> DeciFloatDigits       
    [eE] SignedInteger                     -> DeciFloatExponentPart 
    [\+\-]? [0-9]+                         -> SignedInteger         

  lexical restrictions
    DeciFloatDigits -/- [0-9]
    DeciFloatExponentPart -/- [0-9]

  sorts HexaFloatNumeral HexaSignificand BinaryExponent SignedInteger

  lexical syntax
    HexaSignificand BinaryExponent         -> HexaFloatNumeral 
    [0] [xX] [0-9a-fA-F]+                  -> HexaSignificand  
    [0] [xX] [0-9a-fA-F]* "." [0-9a-fA-F]* -> HexaSignificand  
    [0] [xX] "."                           -> HexaSignificand  {reject}
    [pP] SignedInteger                     -> BinaryExponent   

  lexical restrictions
    HexaSignificand -/- [0-9a-fA-F]
    SignedInteger -/- [0-9]

module languages/java-15/lexical/literals/IntegerLiterals
exports
  sorts IntLiteral DeciLiteral HexaLiteral OctaLiteral DeciNumeral HexaNumeral
        OctaNumeral

  context-free syntax
    DeciLiteral -> IntLiteral {cons("Deci")}
    HexaLiteral -> IntLiteral {cons("Hexa")}
    OctaLiteral -> IntLiteral {cons("Octa")}

  lexical syntax
    DeciNumeral [lL]?     -> DeciLiteral 
    HexaNumeral [lL]?     -> HexaLiteral 
    OctaNumeral [lL]?     -> OctaLiteral 
    "0"                   -> DeciNumeral 
    [1-9] [0-9]*          -> DeciNumeral 
    [0] [xX] [0-9a-fA-F]+ -> HexaNumeral 
    [0] [0-7]+            -> OctaNumeral 

  lexical restrictions
    DeciNumeral -/- [0-9\.fFdD]
    HexaNumeral -/- [0-9a-fA-F]
    OctaNumeral -/- [0-7]
    DeciLiteral -/- [lL]
    HexaLiteral -/- [lL]
    OctaLiteral -/- [lL]

module languages/java-15/lexical/literals/Main
imports languages/java-15/lexical/literals/IntegerLiterals
        languages/java-15/lexical/literals/FloatingPointLiterals
        languages/java-15/lexical/literals/BooleanLiterals
        languages/java-15/lexical/literals/CharacterLiterals
        languages/java-15/lexical/literals/StringLiterals
        languages/java-15/lexical/literals/NullLiteral

module languages/java-15/lexical/Modifiers
exports
  sorts Public Private Protected Abstract Final Static Native Transient Volatile
        Synchronized StrictFP Modifier

  context-free syntax
    "public"       -> Public       {cons("Public")}
    "private"      -> Private      {cons("Private")}
    "protected"    -> Protected    {cons("Protected")}
    "abstract"     -> Abstract     {cons("Abstract")}
    "final"        -> Final        {cons("Final")}
    "static"       -> Static       {cons("Static")}
    "native"       -> Native       {cons("Native")}
    "transient"    -> Transient    {cons("Transient")}
    "volatile"     -> Volatile     {cons("Volatile")}
    "synchronized" -> Synchronized {cons("Synchronized")}
    "strictfp"     -> StrictFP     {cons("StrictFP")}
    Public         -> Modifier     
    Private        -> Modifier     
    Protected      -> Modifier     
    Abstract       -> Modifier     
    Final          -> Modifier     
    Static         -> Modifier     
    Native         -> Modifier     
    Transient      -> Modifier     
    Volatile       -> Modifier     
    Synchronized   -> Modifier     
    StrictFP       -> Modifier     

module languages/java-15/lexical/Keywords
exports
  sorts Keyword

  lexical syntax
    "abstract"     -> Keyword 
    "assert"       -> Keyword 
    "boolean"      -> Keyword 
    "break"        -> Keyword 
    "byte"         -> Keyword 
    "case"         -> Keyword 
    "catch"        -> Keyword 
    "char"         -> Keyword 
    "class"        -> Keyword 
    "const"        -> Keyword 
    "continue"     -> Keyword 
    "default"      -> Keyword 
    "do"           -> Keyword 
    "double"       -> Keyword 
    "else"         -> Keyword 
    "enum"         -> Keyword 
    "extends"      -> Keyword 
    "final"        -> Keyword 
    "finally"      -> Keyword 
    "float"        -> Keyword 
    "for"          -> Keyword 
    "goto"         -> Keyword 
    "if"           -> Keyword 
    "implements"   -> Keyword 
    "import"       -> Keyword 
    "instanceof"   -> Keyword 
    "int"          -> Keyword 
    "interface"    -> Keyword 
    "long"         -> Keyword 
    "native"       -> Keyword 
    "new"          -> Keyword 
    "package"      -> Keyword 
    "private"      -> Keyword 
    "protected"    -> Keyword 
    "public"       -> Keyword 
    "return"       -> Keyword 
    "short"        -> Keyword 
    "static"       -> Keyword 
    "strictfp"     -> Keyword 
    "super"        -> Keyword 
    "switch"       -> Keyword 
    "synchronized" -> Keyword 
    "this"         -> Keyword 
    "throw"        -> Keyword 
    "throws"       -> Keyword 
    "transient"    -> Keyword 
    "try"          -> Keyword 
    "void"         -> Keyword 
    "volatile"     -> Keyword 
    "while"        -> Keyword 

  lexical restrictions
    "abstract" "assert" "boolean" "break" "byte" "case" "catch" "char" "class"
    "const" "continue" "default" "do" "double" "else" "enum" "extends" "final"
    "finally" "float" "for" "goto" "if" "implements" "import" "instanceof" "int"
    "interface" "long" "native" "new" "package" "private" "protected" "public"
    "return" "short" "static" "strictfp" "super" "switch" "synchronized" "this"
    "throw" "throws" "transient" "try" "void" "volatile" "while"
    -/- [A-Za-z0-9\_\$]

module languages/java-15/lexical/Identifiers
imports languages/java-15/lexical/Keywords

exports
  sorts Id ID

  context-free syntax
    ID -> Id {cons("Id")}

  lexical syntax
    [A-Za-z\_\$] [A-Za-z0-9\_\$]* -> ID 
    Keyword                       -> ID {reject}
    "true"                        -> ID {reject}
    "false"                       -> ID {reject}
    "null"                        -> ID {reject}

  lexical restrictions
    ID -/- [a-zA-Z0-9\_\$]

module languages/java-15/lexical/Comments
imports languages/java-15/lexical/LineTerminators

exports
  sorts Comment EOLCommentChars CommentPart UnicodeEscape BlockCommentChars
        Asterisk EscEscChar EscChar

  lexical syntax
    Comment                                                   -> LAYOUT            
    "//" EOLCommentChars LineTerminator                       -> Comment           
    ~[\n\r]*                                                  -> EOLCommentChars   
    "/*" CommentPart* "*/"                                    -> Comment           
    "/**" CommentPart* "*/"                                   -> Comment           
    "/**/"                                                    -> Comment           
    BlockCommentChars                                         -> CommentPart       
    EscChar                                                   -> CommentPart       
    EscEscChar                                                -> CommentPart       
    Asterisk                                                  -> CommentPart       
    UnicodeEscape                                             -> CommentPart       
    ~[\*\\]+                                                  -> BlockCommentChars 
    "*"                                                       -> Asterisk          
    "\\\\"                                                    -> EscEscChar        
    "\\"                                                      -> EscChar           
    "\\" [u]+ [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] -> UnicodeEscape     

  lexical restrictions
    "/**" -/- [\/]
    "/*" -/- [\*]
    Asterisk -/- [\/]
    EscChar -/- [\\u]
    BlockCommentChars -/- ~[\*\\]
    EOLCommentChars -/- ~[\n\13]

  context-free restrictions
    LAYOUT? -/- [\/] . [\*]
    LAYOUT? -/- [\/] . [\/]

module languages/java-15/lexical/WhiteSpace
exports
  lexical syntax
%%    [\ \t\12\r\n] -> LAYOUT 

  context-free restrictions
    LAYOUT? -/- [\ \t\12\n\r]

module languages/java-15/lexical/LineTerminators
exports
  sorts LineTerminator CarriageReturn EndOfFile

  lexical syntax
    [\n]           -> LineTerminator 
    [\r] [\n]      -> LineTerminator 
    CarriageReturn -> LineTerminator 
    EndOfFile      -> LineTerminator 
    [\r]           -> CarriageReturn 

  lexical restrictions
    CarriageReturn -/- [\n]

  lexical syntax
     -> EndOfFile 

  lexical restrictions
    EndOfFile -/- ~[]

module languages/java-15/lexical/UnicodeEscapes
exports
  sorts UnicodeEscape

  syntax
    "\\" [u]+ [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] -> UnicodeEscape {cons("UnicodeEscape")}

module languages/java-15/lexical/Main
imports languages/java-15/lexical/UnicodeEscapes
        languages/java-15/lexical/LineTerminators
        languages/java-15/lexical/WhiteSpace languages/java-15/lexical/Comments
        languages/java-15/lexical/Identifiers languages/java-15/lexical/Keywords
        languages/java-15/lexical/Modifiers
        languages/java-15/lexical/literals/Main

module languages/java-15/Main
imports languages/java-15/lexical/Main languages/java-15/types/Main
        languages/java-15/names/Main languages/java-15/packages/Main
        languages/java-15/classes/Main languages/java-15/interfaces/Main
        languages/java-15/arrays/Main languages/java-15/statements/Main
        languages/java-15/expressions/Main

module Java-15
imports languages/java-15/Main

module org/sugarj/languages/Java
imports Java-15
          [ CompilationUnit       => JavaCompilationUnit
            TypeDec               => JavaTypeDec
            ImportDec             => JavaImportDec
            PackageDec            => JavaPackageDec
            ElemVal               => JavaElemVal
            ElemValPair           => JavaElemValPair
            Anno                  => JavaAnno
            LHS                   => JavaLHS
            CondMid               => JavaCondMid
            ArraySubscript        => JavaArraySubscript
            DimExpr               => JavaDimExpr
            ArrayBaseType         => JavaArrayBaseType
            ArrayCreationExpr     => JavaArrayCreationExpr
            ClassMemberDec        => JavaClassMemberDec
            ClassBodyDec          => JavaClassBodyDec
            Interfaces            => JavaInterfaces
            Super                 => JavaSuper
            ClassMod              => JavaClassMod
            ClassDecHead          => JavaClassDecHead
            ClassBody             => JavaClassBody
            ClassDec              => JavaClassDec
            InterfaceMod          => JavaInterfaceMod
            InterfaceMemberDec    => JavaInterfaceMemberDec
            ExtendsInterfaces     => JavaExtendsInterfaces
            InterfaceDecHead      => JavaInterfaceDecHead
            InterfaceDec          => JavaInterfaceDec
            DefaultVal            => JavaDefaultVal
            AnnoElemDec           => JavaAnnoElemDec
            AnnoDecHead           => JavaAnnoDecHead
            AnnoDec               => JavaAnnoDec
            AbstractMethodMod     => JavaAbstractMethodMod
            AbstractMethodDec     => JavaAbstractMethodDec
            ConstantMod           => JavaConstantMod
            ConstantDec           => JavaConstantDec
            EnumBodyDecs          => JavaEnumBodyDecs
            EnumConstArgs         => JavaEnumConstArgs
            EnumConst             => JavaEnumConst
            EnumBody              => JavaEnumBody
            EnumDecHead           => JavaEnumDecHead
            EnumDec               => JavaEnumDec
            ConstrMod             => JavaConstrMod
            ConstrInv             => JavaConstrInv
            ConstrBody            => JavaConstrBody
            ConstrHead            => JavaConstrHead
            ConstrDec             => JavaConstrDec
            StaticInit            => JavaStaticInit
            InstanceInit          => JavaInstanceInit
            MethodBody            => JavaMethodBody
            ExceptionType         => JavaExceptionType
            Throws                => JavaThrows
            MethodMod             => JavaMethodMod
            VarMod                => JavaVarMod
            FormalParam           => JavaFormalParam
            ResultType            => JavaResultType
            MethodDecHead         => JavaMethodDecHead
            MethodDec             => JavaMethodDec
            BlockStm              => JavaBlockStm
            Block                 => JavaBlock
            CatchClause           => JavaCatchClause
            SwitchLabel           => JavaSwitchLabel
            SwitchGroup           => JavaSwitchGroup
            SwitchBlock           => JavaSwitchBlock
            Stm                   => JavaStm
            LocalVarDec           => JavaLocalVarDec
            LocalVarDecStm        => JavaLocalVarDecStm
            FieldMod              => JavaFieldMod
            VarInit               => JavaVarInit
            Dim                   => JavaDim
            VarDecId              => JavaVarDecId
            VarDec                => JavaVarDec
            FieldDec              => JavaFieldDec
            ArrayInit             => JavaArrayInit
            ClassLiteral          => JavaClassLiteral
            Literal               => JavaLiteral
            Type                  => JavaType
            ArrayType             => JavaArrayType
            TypeVar               => JavaTypeVar
            TypeDecSpec           => JavaTypeDecSpec
            InterfaceType         => JavaInterfaceType
            ClassType             => JavaClassType
            ClassOrInterfaceType  => JavaClassOrInterfaceType
            RefType               => JavaRefType
            TypeVarId             => JavaTypeVarId
            TypeParams            => JavaTypeParams
            TypeBound             => JavaTypeBound
            TypeParam             => JavaTypeParam
            WildcardBound         => JavaWildcardBound
            ActualTypeArg         => JavaActualTypeArg
            TypeArgs              => JavaTypeArgs
            PackageOrTypeName     => JavaPackageOrTypeName
            MethodName            => JavaMethodName
            ExprName              => JavaExprName
            TypeName              => JavaTypeName
            AmbName               => JavaAmbName
            PackageName           => JavaPackageName
            FloatType             => JavaFloatType
            IntType               => JavaIntType
            NumType               => JavaNumType
            PrimType              => JavaPrimType
            NullLiteral           => JavaNullLiteral
            FooStringChars        => JavaFooStringChars
            StringChars           => JavaStringChars
            StringPart            => JavaStringPart
            StringLiteral         => JavaStringLiteral
            SingleChar            => JavaSingleChar
            CharContent           => JavaCharContent
            CharLiteral           => JavaCharLiteral
            LastOcta              => JavaLastOcta
            OctaEscape            => JavaOctaEscape
            NamedEscape           => JavaNamedEscape
            EscapeSeq             => JavaEscapeSeq
            Bool                  => JavaBool
            BoolLiteral           => JavaBoolLiteral
            BinaryExponent        => JavaBinaryExponent
            HexaSignificand       => JavaHexaSignificand
            HexaFloatNumeral      => JavaHexaFloatNumeral
            SignedInteger         => JavaSignedInteger
            DeciFloatExponentPart => JavaDeciFloatExponentPart
            DeciFloatDigits       => JavaDeciFloatDigits
            DeciFloatNumeral      => JavaDeciFloatNumeral
            FloatLiteral          => JavaFloatLiteral
            HexaFloatLiteral      => JavaHexaFloatLiteral
            DeciFloatLiteral      => JavaDeciFloatLiteral
            IntLiteral            => JavaIntLiteral
            OctaNumeral           => JavaOctaNumeral
            HexaNumeral           => JavaHexaNumeral
            DeciNumeral           => JavaDeciNumeral
            OctaLiteral           => JavaOctaLiteral
            HexaLiteral           => JavaHexaLiteral
            DeciLiteral           => JavaDeciLiteral
            Modifier              => JavaModifier
            StrictFP              => JavaStrictFP
            Synchronized          => JavaSynchronized
            Volatile              => JavaVolatile
            Transient             => JavaTransient
            Native                => JavaNative
            Static                => JavaStatic
            Final                 => JavaFinal
            Abstract              => JavaAbstract
            Protected             => JavaProtected
            Private               => JavaPrivate
            Public                => JavaPublic
            Id                    => JavaId
            ID                    => JavaID
            Keyword               => JavaKeyword
            EscChar               => JavaEscChar
            EscEscChar            => JavaEscEscChar
            Asterisk              => JavaAsterisk
            BlockCommentChars     => JavaBlockCommentChars
            CommentPart           => JavaCommentPart
            EOLCommentChars       => JavaEOLCommentChars
            Comment               => JavaComment
            EndOfFile             => JavaEndOfFile
            CarriageReturn        => JavaCarriageReturn
            LineTerminator        => JavaLineTerminator
            UnicodeEscape         => JavaUnicodeEscape
            ArrayAccess           => JavaArrayAccess
            FieldAccess           => JavaFieldAccess
            MethodSpec            => JavaMethodSpec
            Expr                  => JavaExpr ]