Skip to content

Commit a9bc80a

Browse files
committed
Added v2 C# project
So far, token reading and polish notation conversion has been implemented
1 parent cf0980a commit a9bc80a

File tree

14 files changed

+661
-4
lines changed

14 files changed

+661
-4
lines changed

.gitignore

Lines changed: 399 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def prepare_table(expr: Expression):
102102

103103

104104

105-
def simulate(expr: Expression, table: Table):
105+
def simulate_full(expr: Expression, table: Table):
106106

107107
tokens = expr[0]
108108
variables = expr[1]
@@ -136,8 +136,6 @@ def simulate(expr: Expression, table: Table):
136136

137137

138138

139-
140-
141139
def main():
142140
'''Main program loop.'''
143141

@@ -155,7 +153,7 @@ def main():
155153
debug_print(f'Variables: {",".join(expr1[1])}')
156154

157155
table1 = prepare_table(expr1)
158-
table1 = simulate(expr1, table1)
156+
table1 = simulate_full(expr1, table1)
159157

160158
print_table(expr1, table1)
161159

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/bin/Debug/net6.0/BooleanExpressionParser.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach"
24+
}
25+
]
26+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/BooleanExpressionParser.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/BooleanExpressionParser.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/BooleanExpressionParser.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class AndOperatorNode : OperatorNode
2+
{
3+
public AndOperatorNode(Node left, Node right) : base(left, right) { }
4+
5+
public override bool Evaluate()
6+
{
7+
return Left.Evaluate() && Right.Evaluate();
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public abstract class Node
2+
{
3+
4+
public abstract bool Evaluate();
5+
6+
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class NotOperatorNode : OperatorNode
2+
{
3+
public NotOperatorNode(Node left, Node right) : base(left, right) { }
4+
5+
public override bool Evaluate()
6+
{
7+
return !Left.Evaluate();
8+
}
9+
}

0 commit comments

Comments
 (0)