module Writer.Formats.Psl where
import Config
import Simplify
import Data.Error
import Data.Specification
import Writer.Eval
import Writer.Data
import Writer.Utils
opConfig
:: OperatorConfig
opConfig = OperatorConfig
{ tTrue = "true"
, fFalse = "false"
, opNot = UnaryOp "!" 1
, opAnd = BinaryOp "&&" 2 AssocLeft
, opOr = BinaryOp "||" 3 AssocLeft
, opImplies = BinaryOp "->" 6 AssocRight
, opEquiv = BinaryOp "<->" 6 AssocRight
, opNext = UnaryOp "next!" 4
, opFinally = UnaryOp "eventually!" 4
, opGlobally = UnaryOp "always" 7
, opUntil = BinaryOp "until!" 5 AssocRight
, opRelease = BinaryOpUnsupported
, opWeak = BinaryOpUnsupported
}
writeFormat
:: Configuration -> Specification -> Either Error String
writeFormat c s = do
(es,ss,rs,as,is,gs) <- eval c s
fml0 <- merge es ss rs as is gs
fml1 <- simplify (adjust c opConfig) fml0
return $ printFormula opConfig (outputMode c) fml1