logic_tracer

Crates.iologic_tracer
lib.rslogic_tracer
version0.0.15
created_at2023-12-25 22:48:03.592246+00
updated_at2025-11-13 02:47:50.819117+00
descriptionRecognize a logic proposition and trace its truth value, also generate a truth table (still in development)
homepage
repositoryhttps://github.com/Yrrrrrf/logic_tracer
max_upload_size
id1080526
size56,793
Fernando Bryan Reza Campos (Yrrrrrf)

documentation

https://docs.rs/logic_tracer

README

Axion Icon
Logic Tracer

GitHub: Repo License: MIT

Crates.io Crates.io Downloads docs.rs

A Rust library that reads logical propositions and interprets them to build truth tables and ASTs.

Logic Tracer is a Rust library designed to parse and interpret logical propositions, automatically generating truth tables and Abstract Syntax Trees (ASTs) from input expressions. Makes use of regular expressions to validate the input and tokenize the proposition.

🚦 Getting Started

Examples

Check the examples directory to see how to use the crate.

cargo run --example <example name>

Features

Current

  • Read a logical proposition
  • Tokenize the proposition
  • Validate Input Tokens (only valid tokens)
    • Variables (only letters)
    • Logical Operators (and, or, not, implies, iff)
    • Mathematical Operators (add, sub, mul, div, pow)
    • Compounds (only numbers, variables, variable with subindex)

Planned

  • Parse the proposition (make sure it is valid)
  • Build the AST (Shunting Yard Algorithm) (use postfix notation)
  • Add notation to the AST (prefix, infix, postfix)
  • Solve proposition (evaluate the AST)
  • Add good looking output for truth table, ast, function, etc.
  • Reduce a proposition to its simplest form (boolean algebra)
    • Reagrupate Compounds (boolean algebra)
    • Apply De Morgan's laws (boolean algebra)
    • Apply distributive, associative and commutative laws (boolean algebra)
  • Add more examples
  • Add more tests
  • Improve documentation
  • Improve the import/export of the crate (to improve it's usability as a library)

I want to make this crate completely independent of any other crate. So, I will implement the parser myself...

Check PEST grammar declaration using .pest files

📄 License

This project is licensed under the MIT License.

Commit count: 45

cargo fmt