module IBAF-Start
            
imports 
  
  Funcons

// Language "IBAFlang"
    
lexical syntax // Language
  LEX-int = ( [0-9] )+
  LEX-id = ( [a-z] ) ( [a-z] | [0-9] )*
  
syntax // Language
  
context-free syntax // Language
  L-start.L-start--L-exp =
    L-exp
  
  L-exp.L-exp--L-int =
    L-int
  L-exp.L-exp--L-id =
    L-id
  L-exp.L-exp--R-lambda-L-id-DOT-L-exp =
    "lambda" L-id "." L-exp
  L-exp.L-exp--L-exp-LPAREN-L-exp-RPAREN =
    L-exp "(" L-exp ")"
  L-exp.L-exp--R-let-L-id-EQUALS-L-exp-R-in-L-exp =
    "let" L-id "=" L-exp "in" L-exp
  L-exp.L-exp--LPAREN-L-exp-RPAREN =
    "(" L-exp ")"
  
  L-int.LEX-int = 
    LEX-int
  L-id.LEX-id = 
    LEX-id
  
context-free syntax // Semantics
  FCT.T-start =
    "start" "[:" L-start ":]"
  FCT.T-eval =
    "eval" "[:" L-exp ":]"
  FCT-Quoted.L-int = L-int
  FCT.T-int =
    "int" "[:" L-int ":]"
  FCT-Quoted.L-id = L-id
  FCT.T-id =
    "id" "[:" L-id ":]"
  
context-free syntax // Desugaring
  
variables // Meta-variables
  L-start = "(:START" [1-9]? ":)" {prefer}
  L-start? = "(:START" [1-9]? "?:)" {prefer}
  L-start* = "(:START" [1-9]? "*:)" {prefer}
  L-start+ = "(:START" [1-9]? "+:)" {prefer}
  L-exp = "(:E" [1-9]? ":)" {prefer}
  L-exp? = "(:E" [1-9]? "?:)" {prefer}
  L-exp* = "(:E" [1-9]? "*:)" {prefer}
  L-exp+ = "(:E" [1-9]? "+:)" {prefer}
  L-int = "(:N" [1-9]? ":)" {prefer}
  L-int? = "(:N" [1-9]? "?:)" {prefer}
  L-int* = "(:N" [1-9]? "*:)" {prefer}
  L-int+ = "(:N" [1-9]? "+:)" {prefer}
  L-id = "(:X" [1-9]? ":)" {prefer}
  L-id? = "(:X" [1-9]? "?:)" {prefer}
  L-id* = "(:X" [1-9]? "*:)" {prefer}
  L-id+ = "(:X" [1-9]? "+:)" {prefer}
  
// SDF comments
  
sorts // ASTs
  T-start
