mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-17 08:49:31 -06:00
The following are the outcomes:
- Predef.nonExist is fully supported by both the Haskell and the C runtimes
- Predef.BIND is now an internal compiler defined token. For now
it behaves just as usual for the Haskell runtime, i.e. it generates &+.
However, the special treatment will let us to handle it properly in
the C runtime.
- This required a major change in the PGF format since both
nonExist and BIND may appear inside 'pre' and this was not supported
before.
74 lines
1.7 KiB
Haskell
74 lines
1.7 KiB
Haskell
----------------------------------------------------------------------
|
|
-- |
|
|
-- Module : GF.Grammar.Predef
|
|
-- Maintainer : kr.angelov
|
|
-- Stability : (stable)
|
|
-- Portability : (portable)
|
|
--
|
|
-- Predefined identifiers and labels which the compiler knows
|
|
----------------------------------------------------------------------
|
|
|
|
module GF.Grammar.Predef where
|
|
|
|
import GF.Infra.Ident(Ident,identS)
|
|
|
|
cType = identS "Type"
|
|
cPType = identS "PType"
|
|
cTok = identS "Tok"
|
|
cStr = identS "Str"
|
|
cStrs = identS "Strs"
|
|
cPredefAbs = identS "PredefAbs"
|
|
cPredefCnc = identS "PredefCnc"
|
|
cPredef = identS "Predef"
|
|
cInt = identS "Int"
|
|
cFloat = identS "Float"
|
|
cString = identS "String"
|
|
cVar = identS "__gfVar"
|
|
cInts = identS "Ints"
|
|
cPBool = identS "PBool"
|
|
cErrorType = identS "Error"
|
|
cOverload = identS "overload"
|
|
cUndefinedType = identS "UndefinedType"
|
|
cNonExist = identS "nonExist"
|
|
cBIND = identS "BIND"
|
|
|
|
isPredefCat :: Ident -> Bool
|
|
isPredefCat c = elem c [cInt,cString,cFloat]
|
|
|
|
cPTrue = identS "PTrue"
|
|
cPFalse = identS "PFalse"
|
|
cLength = identS "length"
|
|
cDrop = identS "drop"
|
|
cTake = identS "take"
|
|
cTk = identS "tk"
|
|
cDp = identS "dp"
|
|
cToUpper = identS "toUpper"
|
|
cToLower = identS "toLower"
|
|
cIsUpper = identS "isUpper"
|
|
cEqStr = identS "eqStr"
|
|
cEqVal = identS "eqVal"
|
|
cOccur = identS "occur"
|
|
cOccurs = identS "occurs"
|
|
cEqInt = identS "eqInt"
|
|
cLessInt = identS "lessInt"
|
|
cPlus = identS "plus"
|
|
cShow = identS "show"
|
|
cRead = identS "read"
|
|
cToStr = identS "toStr"
|
|
cMapStr = identS "mapStr"
|
|
cError = identS "error"
|
|
|
|
-- * Hacks: dummy identifiers used in various places.
|
|
-- Not very nice!
|
|
|
|
cMeta = identS "?"
|
|
cAs = identS "@"
|
|
cChar = identS "?"
|
|
cChars = identS "[]"
|
|
cSeq = identS "+"
|
|
cAlt = identS "|"
|
|
cRep = identS "*"
|
|
cNeg = identS "-"
|
|
cCNC = identS "CNC"
|
|
cConflict = identS "#conflict"
|