Skip to content

Commit e8ecbcc

Browse files
committed
init
0 parents  commit e8ecbcc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3993
-0
lines changed

.eslintrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
extends: ['plugin:vue/vue3-recommended', 'eslint:recommended', 'prettier'],
7+
plugins: ['vue'],
8+
};

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid"
6+
}

.vscode/extensions.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"lokalise.i18n-ally",
4+
"antfu.iconify",
5+
"dbaeumer.vscode-eslint",
6+
"voorjaar.windicss-intellisense",
7+
"csstools.postcss"
8+
]
9+
}

.vscode/settings.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"editor.quickSuggestions": {
3+
"strings": true
4+
},
5+
"i18n-ally.localesPaths": [
6+
"locales"
7+
],
8+
"i18n-ally.sourceLanguage": "zh-cn",
9+
"i18n-ally.keystyle": "flat",
10+
"css.lint.unknownAtRules": "ignore",
11+
"less.lint.unknownAtRules": "ignore",
12+
"scss.lint.unknownAtRules": "ignore",
13+
}

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
MIT License
3+
4+
Copyright (c) 2020-2021 DAIDR
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<p align='center'><img width="100px" style="display:block; margin:0 auto;" src="./public/icons/apple-touch-icon.png" alt="Truth Table">
2+
</p>
3+
4+
# 真值表
5+
6+
> 一个心血来潮的小项目
7+
8+
示例地址:[https://tb.daidr.me](https://tb.daidr.me)
9+
10+
## 功能
11+
12+
通过给定的逻辑表达式来生成真值表,并且能够给出中间过程。lexer与parser的部分使用antlr编写。
13+
14+
## 一些说明
15+
16+
变元应由字母组成,支持单个字符(如`p` `q`)或多个字符(如`ab` `ac`
17+
大小写不一致的变元被视为不同的变元,如 `A` `a` 为两个不同的变元。
18+
19+
目前支持下面这些逻辑:
20+
21+
* 合取 (∧) (conjunction)
22+
* 非 (¬) (negation)
23+
* 析取 (∨) (disjunction)
24+
* 蕴含 (→) (implication)
25+
* 等值于 (⇔) (equivalence)
26+
27+
由于这些符号普遍较难输入,所以提供了一些常见符号用于代换,使用的时候软件会自动帮你将下面这些符号替换为对应的逻辑符号:
28+
29+
* 合取 `&` `^`
30+
*`` `!`
31+
* 析取 `|`
32+
* 蕴含 `>` ``
33+
* 等值于 `=`
34+
35+
可以使用括号修改运算的优先级。
36+
37+
> 由于这个小项目是一天时间糊出来的,代码写的非常乱,之后有时间再整理吧🥱
38+
39+
### 安装依赖
40+
41+
```
42+
pnpm
43+
```
44+
45+
or
46+
47+
```
48+
yarn
49+
```
50+
51+
### 启动项目
52+
53+
```
54+
pnpm dev
55+
```
56+
57+
or
58+
59+
```
60+
yarn dev
61+
```
62+
63+
vite调试服务会在 [http://localhost:4000](http://localhost:4000) 启动
64+
65+
### 构建
66+
67+
```
68+
pnpm build
69+
```
70+
71+
or
72+
73+
```
74+
yarn build
75+
```
76+
77+
构建的结果会输出到 `dist` 目录下

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Truth Table | 真值表</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

locales/en.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"locate.en": "English",
3+
"locate.zh-cn": "简体中文",
4+
"page.title": "Truth Table",
5+
"toolbar.github": "Github",
6+
"toolbar.theme": "Toggle Theme",
7+
"toolbar.layout": "Toggle Layout",
8+
"toolbar.intermediate": "Toggle Intermediate Processes",
9+
"input.placeholder": "Enter the logical expression to be computed",
10+
"lexer.title": "Lexer Result",
11+
"toolbar.debug": "Toggle DebugMode",
12+
"parser.error.title": "ERROR",
13+
"parser.error.notvaild": "Input is not a valid logic expression.",
14+
"parser.error.syntax": "[Syntax ERROR :{column}] {msg}",
15+
"parser.title": "Parser Result",
16+
"lexer.startpos": "START:",
17+
"lexer.stoppos": "STOP: ",
18+
"lexer.value": "VALUE: ",
19+
"lexer.type": "TYPE: ",
20+
"parser.used-var": "Used Variables: ",
21+
"parser.used-var.empty": "EMPTY",
22+
"parser.used-subsequence": "Used Subsequences: ",
23+
"table.title": "Truth Table"
24+
}

locales/zh-cn.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"locate.en": "English",
3+
"locate.zh-cn": "简体中文",
4+
"page.title": "真值表",
5+
"toolbar.github": "Github",
6+
"toolbar.theme": "切换主题",
7+
"toolbar.layout": "切换布局",
8+
"toolbar.intermediate": "切换中间过程",
9+
"input.placeholder": "键入需要计算的逻辑表达式",
10+
"lexer.title": "词法分析结果",
11+
"toolbar.debug": "切换调试模式",
12+
"parser.error.title": "错误",
13+
"parser.error.notvaild": "不是一个有效的逻辑表达式",
14+
"parser.error.syntax": "[语法错误 :{column}] {msg}",
15+
"parser.title": "语法分析结果",
16+
"lexer.startpos": "开始位置:",
17+
"lexer.stoppos": "结束位置:",
18+
"lexer.value": "值:",
19+
"lexer.type": "类型:",
20+
"parser.used-var": "使用的变量:",
21+
"parser.used-var.empty": "",
22+
"parser.used-subsequence": "子序列:",
23+
"table.title": "真值表"
24+
}

netlify.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[build.environment]
2+
NPM_FLAGS = "--prefix=/dev/null"
3+
NODE_VERSION = "16"
4+
5+
[build]
6+
publish = "dist"
7+
command = "pnpm build || ( npm install pnpm && pnpm build )"
8+
9+
[[redirects]]
10+
from = "/*"
11+
to = "/index.html"
12+
status = 200

package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "truth-table",
3+
"version": "0.0.1",
4+
"description": "A program to calculate and show truth tables",
5+
"scripts": {
6+
"dev": "vite --open --host",
7+
"build": "vue-tsc --noEmit && vite build",
8+
"serve": "vite preview"
9+
},
10+
"dependencies": {
11+
"antlr4": "^4.9.3",
12+
"global": "^4.4.0",
13+
"pinia": "^2.0.11",
14+
"vue": "^3.2.31",
15+
"vue-i18n": "^9.2.0-beta.30",
16+
"vue-router": "^4.0.12"
17+
},
18+
"devDependencies": {
19+
"@iconify/iconify": "^2.1.2",
20+
"@iconify/json": "^2.1.3",
21+
"@iconify/vue": "^3.1.4",
22+
"@intlify/vite-plugin-vue-i18n": "^3.3.0",
23+
"@types/node": "^17.0.18",
24+
"@vitejs/plugin-vue": "^2.2.2",
25+
"@vueuse/core": "^7.6.2",
26+
"pathe": "^0.2.0",
27+
"typescript": "^4.5.5",
28+
"unplugin-vue-components": "^0.17.18",
29+
"vite": "^2.8.4",
30+
"vite-plugin-purge-icons": "^0.7.0",
31+
"vite-plugin-windicss": "^1.7.1",
32+
"vite-svg-loader": "^3.1.2",
33+
"vue-tsc": "^0.31.4",
34+
"windicss": "^3.4.3"
35+
}
36+
}

0 commit comments

Comments
 (0)