Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

License

NotificationsYou must be signed in to change notification settings

daidr/truth-table

Repository files navigation

Truth Table

真值表

一个心血来潮的小项目

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

功能

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

一些说明

变元应由字母和数字组成,支持单个字符(如pq)或多个字符(如abaca1a2)大小写不一致的变元被视为不同的变元,如Aa 为两个不同的变元。必须由字母开头,如a5b6 合法,而5a5 不合法

目前支持下面这些逻辑:

  • 合取 (∧) (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

About

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

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp