Giter Site home page Giter Site logo

daidr / truth-table Goto Github PK

View Code? Open in Web Editor NEW
61.0 2.0 4.0 291 KB

根据逻辑表达式生成对应真值表 (Generate corresponding truth table from logical expression)

Home Page: https://tb.daidr.me

License: MIT License

JavaScript 39.56% HTML 1.33% Vue 51.43% TypeScript 6.35% CSS 0.53% ANTLR 0.80%
truth-table truth-table-generator math logic

truth-table's Introduction

Truth Table

真值表

一个心血来潮的小项目

示例地址:https://tb.daidr.me

功能

通过给定的逻辑表达式来生成真值表,并且能够给出中间过程。lexer与parser的部分使用antlr编写。

一些说明

变元应由字母和数字组成,支持单个字符(如p q)或多个字符(如ab ac a1 a2) 大小写不一致的变元被视为不同的变元,如 A a 为两个不同的变元。 必须由字母开头,如 a5 b6 合法,而 5a 5 不合法

目前支持下面这些逻辑:

  • 合取 (∧) (conjunction)
  • 非 (¬) (negation)
  • 析取 (∨) (disjunction)
  • 蕴涵 (→) (implication)
  • 等值于 (⇔) (equivalence)

由于这些符号普遍较难输入,所以提供了一些常见符号用于代换,使用的时候软件会自动帮你将下面这些符号替换为对应的逻辑符号:

  • 合取 & ^
  • !
  • 析取 |
  • 蕴涵 >
  • 等值于 =

运算优先级(由高到低递减): ¬ ,其中连续的蕴涵运算由右向左合并(例如 a→b→c 等价于 a→(b→c)

可以使用括号修改运算的优先级。

由于这个小项目是一天时间糊出来的,代码写的非常乱,之后有时间再整理吧🥱

开发

安装依赖

pnpm

or

yarn

启动项目

pnpm dev

or

yarn dev

vite调试服务会在 http://localhost:4000 启动

构建

pnpm build

or

yarn build

构建的结果会输出到 dist 目录下

为我投票

Truth Table - Generate corresponding truth table from logical expression | Product Hunt

truth-table's People

Contributors

daidr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yunser asuzsh

truth-table's Issues

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.