1
0
forked from GitHub/gf-core

Some more documentation

This commit is contained in:
krasimir
2008-06-02 07:45:45 +00:00
parent e5421e15ea
commit 7bab5ed958
2 changed files with 21 additions and 14 deletions

View File

@@ -5,7 +5,11 @@
-- Stability : stable -- Stability : stable
-- Portability : portable -- Portability : portable
-- --
-- Application Programming Interface to PGF. -- This module is an Application Programming Interface to
-- to load and interpret grammars compiled Portable Grammar Format (PGF).
-- The PGF format is produced as a final output from the GF compiler.
-- The API is meant to be used when embedding GF grammars in Haskell
-- programs.
------------------------------------------------- -------------------------------------------------
module PGF( module PGF(
@@ -24,7 +28,7 @@ module PGF(
Category, categories, startCat, Category, categories, startCat,
-- * Expressions -- * Expressions
Exp(..), Exp(..), Equation(..),
showExp, readExp, showExp, readExp,
-- * Operations -- * Operations
@@ -61,10 +65,6 @@ import qualified Text.PrettyPrint as PP
import qualified Text.ParserCombinators.ReadP as RP import qualified Text.ParserCombinators.ReadP as RP
-- This API is meant to be used when embedding GF grammars in Haskell
-- programs. The embedded system is supposed to use the
-- .pgf grammar format, which is first produced by the gf program.
--------------------------------------------------- ---------------------------------------------------
-- Interface -- Interface
--------------------------------------------------- ---------------------------------------------------

View File

@@ -42,15 +42,18 @@ data Type =
DTyp [Hypo] CId [Exp] DTyp [Hypo] CId [Exp]
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
-- | An expression representing the abstract syntax tree
-- in PGF. The same expression is used in the dependent
-- types.
data Exp = data Exp =
EAbs [CId] Exp EAbs [CId] Exp -- ^ lambda abstraction. The list should contain at least one variable
| EApp CId [Exp] | EApp CId [Exp] -- ^ application. Note that unevaluated lambda abstractions are not allowed
| EStr String | EStr String -- ^ string constant
| EInt Integer | EInt Integer -- ^ integer constant
| EFloat Double | EFloat Double -- ^ floating point constant
| EMeta Integer | EMeta Integer -- ^ meta variable
| EVar CId | EVar CId -- ^ variable reference
| EEq [Equation] | EEq [Equation] -- ^ lambda function defined as a set of equations with pattern matching
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
data Term = data Term =
@@ -79,6 +82,10 @@ data Hypo =
Hyp CId Type Hyp CId Type
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
-- | The equation is used to define lambda function as a sequence
-- of equations with pattern matching. The list of 'Exp' represents
-- the patterns and the second 'Exp' is the function body for this
-- equation.
data Equation = data Equation =
Equ [Exp] Exp Equ [Exp] Exp
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)