judge-0.1.2.0: Tableau-based theorem prover.

Copyright(c) 2017 2018 N Steenbergen
LicenseGPL-3
Maintainerns@slak.ws
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Logic.Judge.Formula.Parser

Contents

Description

Attoparsec-based parser for various logical (sub)structures.

Synopsis

Parser typeclass

class Parseable a where Source #

A Parseable is something with an associated Attoparsec Parser.

Minimal complete definition

parser

Methods

parser :: Parser a Source #

A parser for type a.

parserEmbedded :: Parser a Source #

In some cases, the parser for a type must be embellished with some other symbols when it occurs as part of a parser of a different type, but not when it occurs on its own. This parser allows us to specify this alternative.

parse :: (Monad m, Parseable a) => Text -> m a Source #

Read a text into a parseable structure.

Formula parsers

formula :: Parser ext -> Parser (Formula ext) Source #

Builds a parser for formulas of classical propositional logic extended with some type e.

modality :: Parser Modality Source #

Parser for modal operators of modal logic.

justification :: Parser Justification Source #

Parser for justification terms of justification logic.

quantifier :: Parser Quantifier Source #

Parser for quantifiers of first-order predicate logic.

Auxiliary parsers

named :: Parser x -> Parser (String, x) Source #

Make a parser for something that is named by prepending it with an identifier and a = sign.

marked :: Parser formula -> Parser (Marked formula) Source #

Parser for a marked formula.

identifier :: Parser String Source #

Parser that accepts and returns any string that starts with a letter.

boolean :: Parser Bool Source #

Parser that accepts a boolean (as binary number or unicode ⊥, ⊤).

comments :: Parser () Source #

Parser for comments.

Generic parser building

data Operator a Source #

Operators wrap a parser for a function in additional information. Note that the function they wrap must take arguments of the same type.

expression :: [[Operator a]] -> Parser a -> Parser a Source #

Build a parser for a recursive expression with prefix-, infix- and postfix operators. Note: To avoid ambiguous left/right associative operators, don't put multiple operators of different associative direction into one precedence bucket.

ambiguity :: [Parser a] -> Parser [a] Source #

Given a number of parsers that introduce an ambiguity (e.g. parsers that may succeed on precisely the same text), collects the results of all successful parses, provided that at least one succceeds.