module stratego/rtg/signature

/**
 * Main RTG structure
 */
signature
  constructors
    RTG       : Start * ProdRules -> RTG
    Start     : List(NonTerm)     -> Start
    ProdRules : List(ProdRule)    -> ProdRules

    ProdRule  : NonTerm * List(AnnotateTreeFN) -> ProdRule
                  : TreeFN -> AnnoTreeFN

    Appl      : Term * List(AnnoTreeFN) -> TreeFN
    Ref       : NonTerm                 -> TreeFN

    Annotated : TreeFN * List(Labelled) -> AnnoTreeFN
    Labelled  : Id * AnnoTreeFN         -> Labelled

/**
 * Non Terminals
 */
signature
  constructors
    String    : NonTerm
    Int       : NonTerm
    Nonterm   : NonTermId -> NonTerm
    Set       : List(NonTerm) -> NonTerm
    Generated : TreeFN -> NonTerm

    Term      : Id -> Term

    Quoted    : List(QuotedIdPart) -> Id
    Plain     : String -> Id

    Chars     : String -> QuotedIdPart
    EscapeSeq : Int -> QuotedIdPart    

/**
 * Terminals
 */    
signature
  constructors
    /**
     * User-defined terminal.
     */
    Term : Id -> Term

    /**
     * [x | xs]. A cons terminal application must 
     * always have 2 arguments, of which the 2nd must a list.
     */
    ConsTerm : Term

    /**
     * []. A nil terminal application is not allowed
     * to have any arguments.
     */
    NilTerm : Term

    /**
     * Tuple of n elements.
     *
     * The number of arguments
     * of a tuple terminal application must always be n.
     */
    TupleTerm : Int -> Term

    /**
     * Integer terminal.
     *
     * Cannot have arguments.
     */
    IntTerm : Term

    /**
     * String terminal
     *
     * Cannot have arguments.
     */
    StringTerm : Term

    /**
     * [xs*, xs*]. A conc terminal application must 
     * always have 2 arguments. both must a list.
     */
    ConcTerm : Term

    SomeTerm : Term

    NoneTerm : Term