You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-7
Original file line number
Diff line number
Diff line change
@@ -22,17 +22,17 @@ A simple boolean expression parser written in C#. It parses boolean expressions
22
22
23
23
## Running
24
24
25
-
After downloading a release from the Releases section to the right, you can run the program on either Windows or Linux by running `BooleanExpressionParser.exe` or `BooleanExpressionParser` in the terminal respectively. Note, you'll need .NET 6 installed on your machine to run the program.
25
+
After downloading a release from the Releases section to the right, you can run the program on either Windows or Linux by running `BooleanExpressionParser.exe` or `BooleanExpressionParser` in the terminal respectively. Note, you'll need .NET 7 installed on your machine to run the program.
26
26
27
27
28
28
## Building
29
29
30
-
To build the project, you'll need .NET 6 installed. You can then build the project with `dotnet build` or run it with `dotnet run`. Alternatively, you can open the project in Visual Studio or Visual Studio Code, the latter of which has config in the repo.
30
+
To build the project, you'll need .NET 7 installed. You can then build the project with `dotnet build` or run it with `dotnet run`. Alternatively, you can open the project in Visual Studio or Visual Studio Code, the latter of which has config in the repo.
31
31
32
32
33
33
## Display
34
34
35
-
The application displays an intuitive truth table output for each boolean expression:
35
+
The application displays an intuitive, coloured truth table output for each boolean expression:
36
36
```
37
37
┏━━━━━━━━┳━━━━━━━┓ ┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
38
38
┃ A B ┃ A.B ┃ ┃ A B C ┃ (!A.B)[XOR]C ┃
@@ -51,7 +51,18 @@ The application displays an intuitive truth table output for each boolean expres
51
51
52
52
## Usage
53
53
54
-
Run `./BooleanExpressionParser <args>` from the command line. `args` is a list of boolean expressions to parse. If no arguments are given, the program will prompt you to enter them into the console.
54
+
### Truth table generation
55
+
`./BooleanExpressionParser table <expression(s)>`
56
+
#### Arguments:
57
+
- <expression(s)> The boolean expression(s) to evaluate
58
+
#### Options:
59
+
- -t, --true <true> Character to use for true values in the truth table. [default: 1]
60
+
- -f, --false <false> Character to use for false values in the truth table. [default: 0]
61
+
62
+
More usage options to be implemented in the future.
63
+
64
+
For help, run `./BooleanExpressionParser --help`. For help with a specific command, run `./BooleanExpressionParser <command> --help`.
65
+
55
66
56
67
57
68
## Expressions
@@ -65,15 +76,21 @@ Shown below is a list of supported operators. Each operator's aliases are listed
65
76
- NAND
66
77
- NOR
67
78
- XNOR
79
+
- IMPLICATION ('=>')
68
80
69
-
Of course, you can also use brackets to group expressions. Every type of bracket can be used, which may help distinguish groupings: `()``[]``{}``<>`
81
+
Of course, you can also use brackets to group expressions. Every type of bracket can be used, which may help distinguish groupings: `()``[]``{}`
70
82
71
83
72
84
## Variables
73
85
74
86
Any characters in an expression which arent operators or brackets are considered variables. The parser will automatically generate a truth table for each variable. Variables can be several characters long, which allows for numbered variables (`A1`, `A_2`, etc.).
75
87
76
-
The final truth table is ordered by the order in which the variables are encountered in the expression. For example, the expression `X | A & B` will have the variables ordered `X`, `A`, `B` in the truth table.
88
+
To provide an order in which the variables should be printed, give a comma separated list of variables after your expression, separating these parts with a semicolon (`;`). If this isn't given, the truth table is generated in the order the variables are found in the expression.
89
+
90
+
For example:
91
+
- The expression "D0.!S + D1.S" would generate a truth table ordered D0, D1, S.
92
+
- The expression "D0.!S + D1.S;S,D0,D1" would generate a truth table ordered S, D0, D1.
93
+
77
94
78
95
79
96
## How it works
@@ -116,7 +133,7 @@ The final truth table is ordered by the order in which the variables are encount
116
133
- A simple OR gate
117
134
- `!S . D_0 + D_1 . S`
118
135
- A 2-1 multiplexer
119
-
- `(!S0 AND ¬S1 . D0) | (NOT<S0> . S1 . D1) + (S0 . {¬S1 & D2}) OR [S0 . S1 AND D3]`
136
+
- `(!S0 AND ¬S1 . D0) | (NOT{S0} . S1 . D1) + (S0 . {¬S1 & D2}) OR [S0 . S1 AND D3]`
120
137
- A 4-1 multiplexer, using several aliases for operators and brackets
0 commit comments