git @ Cat's Eye Technologies Philomath / master include / formula.h
master

Tree @master (Download .tar.gz)

formula.h @masterraw · history · blame

/* formula.h */

/*
 * SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
 * For more information, please refer to <https://unlicense.org/>
 * SPDX-License-Identifier: Unlicense
 */

#ifndef FORMULA_H
#define FORMULA_H 1

#include <stdio.h>  /* for definition of FILE only */

#define VAR  0
#define CONJ 1
#define DISJ 2
#define IMPL 3
#define NEG  4
#define ABSR 5

struct formula {
    int type;
    const char *name;
    struct formula *lhs;  /* will be NULL for NEG, ABSR */
    struct formula *rhs;  /* will be NULL for ABSR */
};

struct formula *var(const char *);
struct formula *conj(struct formula *, struct formula *);
struct formula *disj(struct formula *, struct formula *);
struct formula *impl(struct formula *, struct formula *);
struct formula *neg(struct formula *);
struct formula *absr(void);

int formula_eq(struct formula *, struct formula *);
struct formula *formula_clone(struct formula *);
void formula_fprint(FILE *, struct formula *);

#endif /* ndef FORMULA_H */