Subversion

Galculator

[/] [experimental-src/] [Grammar/] [Galois.def] - Rev 11 Go to most recent revision

Compare with Previous - Blame



definition

module Main
  imports Type Whitespace
  exports 
    context-free start-symbols Top
    sorts Top
    context-free syntax
      Type -> Top

module Type
  imports Identifier
  exports
    sorts Type
    context-free syntax
      "(" Type ")" -> Type { bracket }
      Variable -> Type
      "One" -> Type
      "Bool"                -> Type
      "Char"                -> Type
      "String"              -> Type
      "Int"                 -> Type
      "Float"               -> Type

      "Maybe" Type -> Type
      "Set" Type -> Type
      "List" Type -> Type
      Type "<-|" Type -> Type { right }
      Type "><" Type -> Type { right }
      Type "-|-" Type -> Type { right }
      Type "<-" Type -> Type { right }
      Type "<->" Type -> Type { right }
      Type "~~" Type -> Type { noassoc }
      "Ord" Type -> Type 
      "Expr" Type -> Type

    context-free priorities
      "Maybe" Type -> Type >
      {"Set" Type -> Type 
       "List" Type -> Type} >
      Type "<-|" Type -> Type >
      {Type "><" Type -> Type
       Type "-|-" Type -> Type} >
      {Type "<-" Type -> Type
       Type "<->" Type -> Type} >
      Type "~~" Type -> Type >
      "Ord" Type -> Type >
      "Expr" Type -> Type

module Identifier
  exports
    sorts Identifier Variable

    lexical syntax
      [A-Z][A-Za-z\_0-9\']* -> Identifier

      [a-z][A-Za-z\_0-9\']* -> Variable

    lexical restrictions
      Identifier -/- [A-Za-z\_0-9\']
      Variable   -/- [A-Za-z\_0-9\']

module Whitespace
  exports
    lexical syntax 
      [\ \t\n\r] -> LAYOUT

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

Theme by Vikram Singh | Powered by WebSVN v1.61