hets -- a heterogenous Specification (CASL) tool setContentsIndex
Syntax.Parse_AS_Architecture
Portability non-portable (via imports)
Stability provisional
Maintainer m.makowski@students.mimuw.edu.pl Year : 2003 Copyright : Licence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
Contents
Parsing functions
Description

Parsing the architectural part of heterogenous specifications. www.cofi.info from 25 March 2001

C.2.3 Architectural Specifications

TODO: - make sure the precedence is OK - annotations - see specific TODOs in functions

Synopsis
annotedArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
archSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
groupArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
basicArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
unitDeclDefns :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_DECL_DEFN]
unitDeclDefn :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
unitDecl :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
unitSpec :: (AnyLogic, LogicGraph) -> AParser UNIT_SPEC
unitArgs :: (AnyLogic, LogicGraph) -> AParser ([Annoted SPEC], [Pos])
nonemptyUnitArgs :: (AnyLogic, LogicGraph) -> AParser ([Annoted SPEC], [Pos])
groupUnitTerms :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_TERM]
groupUnitTerm :: (AnyLogic, LogicGraph) -> AParser UNIT_TERM
fitArgUnits :: (AnyLogic, LogicGraph) -> AParser ([FIT_ARG_UNIT], [Pos])
fitArgUnit :: (AnyLogic, LogicGraph) -> AParser FIT_ARG_UNIT
unitTerm :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
unitTermAmalgamation :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
unitTermLocal :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
unitTermTransRed :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
unitTermTransRed' :: (AnyLogic, LogicGraph) -> Annoted UNIT_TERM -> AParser (Annoted UNIT_TERM)
renaming :: (AnyLogic, LogicGraph) -> AParser RENAMING
restriction :: (AnyLogic, LogicGraph) -> AParser RESTRICTION
unitExpr :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_EXPRESSION)
unitBindings :: (AnyLogic, LogicGraph) -> AParser ([UNIT_BINDING], [Pos])
unitBinding :: (AnyLogic, LogicGraph) -> AParser UNIT_BINDING
unitDefns :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_DECL_DEFN]
unitDefn :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
Parsing functions
annotedArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
Parse annotated architectural specification
archSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
Parse architectural specification ARCH-SPEC ::= BASIC-ARCH-SPEC | GROUP-ARCH-SPEC
groupArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
Parse group architectural specification GROUP-ARCH-SPEC ::= { ARCH-SPEC } | ARCH-SPEC-NAME
basicArchSpec :: (AnyLogic, LogicGraph) -> AParser (Annoted ARCH_SPEC)
Parse basic architectural specification BASIC-ARCH-SPEC ::= unitunits UNIT-DECL-DEFNS result UNIT-EXPRESSION ;
unitDeclDefns :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_DECL_DEFN]
Parse a nonempty list of unit declarations or definitions separated by semicolons, with optional semicolon at the end. UNIT-DECL-DEFNS ::= UNIT-DECL-DEFN ; ... ; UNIT-DECL-DEFN ;
unitDeclDefn :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
Parse unit declaration or definition UNIT-DECL-DEFN ::= UNIT-DECL | UNIT-DEFN
unitDecl :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
Parse unit declaration UNIT-DECL ::= UNIT-NAME : UNIT-SPEC | UNIT-NAME : UNIT-SPEC given GROUP-UNIT-TERMS
unitSpec :: (AnyLogic, LogicGraph) -> AParser UNIT_SPEC
Parse unit specification UNIT-SPEC ::= SPEC-NAME | UNIT-ARGS GROUP-SPEC | arch spec GROUP-ARCH-SPEC | closed UNIT-SPEC TODO: check the precedence
unitArgs :: (AnyLogic, LogicGraph) -> AParser ([Annoted SPEC], [Pos])

Parse a (possibly empty) list of group specs separated by * and ending with ->. UNIT-ARGS ::= GROUP-SPEC * ... * GROUP-SPEC ->

returns the list of (annotated) group specs and a list of * and -> positions

nonemptyUnitArgs :: (AnyLogic, LogicGraph) -> AParser ([Annoted SPEC], [Pos])

Parse a nonempty list of group specs separated by * and ending with ->. UNIT-ARGS ::= GROUP-SPEC * ... * GROUP-SPEC ->

returns the list of (annotated) group specs and a list of * and -> positions

groupUnitTerms :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_TERM]
Parse a nonempty list of group unit terms separated by commas. The positions of commas are stored in annotations. GROUP-UNIT-TERMS ::= GROUP-UNIT-TERM ,..., GROUP-UNIT-TERM
groupUnitTerm :: (AnyLogic, LogicGraph) -> AParser UNIT_TERM
Parse group unit term GROUP-UNIT-TERM ::= UNIT-NAME | UNIT-NAME FIT-ARG-UNITS | { UNIT-TERM }
fitArgUnits :: (AnyLogic, LogicGraph) -> AParser ([FIT_ARG_UNIT], [Pos])

Parse the (possibly empty) list of arguments for unit application. FIT-ARG-UNITS ::= [ FIT-ARG-UNIT ] ... [ FIT-ARG-UNIT ]

returns a list of arguments for unit application and a list of [ and ] positions

fitArgUnit :: (AnyLogic, LogicGraph) -> AParser FIT_ARG_UNIT
Parse an argument for unit application. FIT-ARG-UNIT ::= UNIT-TERM | UNIT-TERM fit SYMB-MAP-ITEMS-LIST The SYMB-MAP-ITEMS-LIST is parsed using parseItemsMap.
unitTerm :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
Parse unit term. UNIT-TERM ::= UNIT-TERM RENAMING | UNIT-TERM RESTRICTION | UNIT-TERM and ... and UNIT-TERM | local UNIT-DEFNS within UNIT-TERM | GROUP-UNIT-TERM This will be done by subsequent functions in order to preserve the operator precedence; see other unitTerm functions.
unitTermAmalgamation :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
Parse unit amalgamation. UNIT-TERM-AMALGAMATION ::= UNIT-TERM-LOCAL and ... and UNIT-TERM-LOCAL
unitTermLocal :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
Parse local unit term UNIT-TERM-LOCAL ::= local UNIT-DEFNS within UNIT-TERM-LOCAL | UNIT-TERM-TRANS-RED
unitTermTransRed :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_TERM)
Parse translation or reduction unit term The original grammar UNIT-TERM-TRANS-RED ::= UNIT-TERM-TRANS-RED RENAMING | UNIT-TERM-TRANS-RED RESTRICTION | GROUP-UNIT-TERM has been rewritten to UNIT-TERM-TRANS-RED ::= GROUP-UNIT-TERM UNIT-TERM-TRANS-RED' UNIT-TERM-TRANS-RED' ::= RENAMING UNIT-TERM-TRANS-RED' | RESTRICTION UNIT-TERM-TRANS-RED' | EPSILON in order to eliminate left-hand-side recursion.
unitTermTransRed'
:: (AnyLogic, LogicGraph)
-> Annoted UNIT_TERMthe unit term that came before the renaming or restriction clause
-> AParser (Annoted UNIT_TERM)the resulting unit term
Parse the helper unit term productions
renaming :: (AnyLogic, LogicGraph) -> AParser RENAMING
Parse renaming RENAMING ::= with SYMB-MAP-ITEMS-LIST SYMB-MAP-ITEMS-LIST is parsed using parseMapping
restriction :: (AnyLogic, LogicGraph) -> AParser RESTRICTION
Parse restriction RESTRICTION ::= hide SYMB-ITEMS-LIST | reveal SYMB-MAP-ITEMS-LIST SYMB-ITEMS-LIST is parsed using parseHiding; SYMB-MAP-ITEMS-LIST is parsed using parseItemsMap
unitExpr :: (AnyLogic, LogicGraph) -> AParser (Annoted UNIT_EXPRESSION)
Parse unit expression UNIT-EXPRESSION ::= lambda UNIT-BINDINGS . UNIT-TERM | UNIT-TERM
unitBindings :: (AnyLogic, LogicGraph) -> AParser ([UNIT_BINDING], [Pos])

Parse a nonempty list of unit bindings separated by semicolons.

returns the list of unit bindings and a list of semicolon positions

unitBinding :: (AnyLogic, LogicGraph) -> AParser UNIT_BINDING
Parse unit binding UNIT-BINDING ::= UNIT-NAME : UNIT-SPEC
unitDefns :: (AnyLogic, LogicGraph) -> AParser [Annoted UNIT_DECL_DEFN]
Parse a nonempty list of unit definitions separated by semicolons, with optional semicolon at the end. UNIT-DEFNS ::= UNIT-DEFN ; ... ; UNIT-DEFN ;
unitDefn :: (AnyLogic, LogicGraph) -> AParser UNIT_DECL_DEFN
Parse an unit definition UNIT-DEFN ::= UNIT-NAME = UNIT-EXPRESSION
Produced by Haddock version 0.6