The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Logic::Expr - logical expression parsing and related routines

SYNOPSIS

  use Logic::Expr::Parser;

  # Parser::MGC also supports "from_file"
  my $le = Logic::Expr::Parser->new->from_string('Xv~Y');

  # and then see Logic::Expr for uses of the $le object

DESCRIPTION

This module parses logic expressions and returns a Logic::Expr object, which in turn has various methods for acting on the expression thus parsed.

Parser::MGC is the parent class used to parse the expressions; from_string and from_file are the most relevant methods.

SYNTAX SANS EBNF

The usual atomic letters (X, Y, etc) are extended to include words in capital letters to allow for more than 26 atoms, or at least more descriptive names, for better or worse.

Operators include ! or ~ for negation of the subsequent atom or parenthesized term, and the binary operators

  | v  or            TTTF lojban .a
  &    and           TFFF lojban .e
  ->   conditional   TFTT lojban .a with first term negated
  ==   biconditional TFFT lojban .o

which taken together allow for such expressions as

  X&!Y
  GILBERT&SULLIVAN
  (CAT|DOG)->FISH
  ALIENvPREDICATOR
  ETC

MINUTIAE

Code coverage tools can be persnickety about these sorts of things.

on_parse_end

Internal Parser::MGC hook function.

parse

Internal Parser::MGC function.

BUGS

None known.

COPYRIGHT AND LICENSE

Copyright 2022 Jeremy Mates

This program is distributed under the (Revised) BSD License: https://opensource.org/licenses/BSD-3-Clause