GithubHelp home page GithubHelp logo

nstouls / firstorderparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rindphi/firstorderparser

0.0 1.0 0.0 41 KB

A parser for first-order (predicate) logic, created with JavaCC. Includes basic model classes.

Java 100.00%

firstorderparser's Introduction

	Copyright 2014 Dominic Scheurer
	
	This file is part of FirstOrderParser.
	 
	FirstOrderParser is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	 
	FirstOrderParser is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	 
	You should have received a copy of the GNU General Public License
	along with FirstOrderParser.  If not, see <http://www.gnu.org/licenses/>.

######################################
#          FirstOrderParser          #
# Copyright 2014 by Dominic Scheurer #
######################################

FirstOrderParser is a parser for first-order (predicate) logic written
in JavaCC. The shipped model classes feature the basic operations of
substitution and free variables computation.

--------------------------------------

For the JavaCC grammar file, see de/dominicscheurer/fol/parser/FOLGrammar.jj

--------------------------------------

Allowed syntax:

term  ::= var | fun | fun terms
terms ::= "(" term ")" | "(" term "," terms ")"
form  ::=   pred
          | pred terms
          | "!" form
          | "(" form "&" form ")"
          | "(" form "|" form ")"
          | "(" form "->" form ")"
          | "exists " var "." form
          | "forall " var "." form
          
where variables (var) start with upper case letters, and predicates (pred) and
functions (fun) start with lower case letters. Digits and underscores are allowed,
superfluous whitespace is ignored.

--------------------------------------

The main class is de.dominicscheurer.fol.parser.FOLParser. Example usage:

Formula formula = FOLParser.parse(
	"forall X. (p(X,Y) & exists Y. (p(Y,f(X,Y)) -> (q(c) | !r)))"
);
formula.substitute(new Term("d"), new Variable("Y"));

--------------------------------------

JUnit test cases are contained in the class de.dominicscheurer.fol.test.FOLParserTest

firstorderparser's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.