Updated readme: added REPL and errors examples
This commit is contained in:
parent
7ef2c86ce6
commit
6a17551d5c
26
README.md
26
README.md
@ -1,15 +1,31 @@
|
|||||||
# Reverse Polish notation calculator in .NET C#
|
# Reverse Polish notation calculator in .NET C#
|
||||||
|
|
||||||
Pass RPN expression as one string as an argument.
|
Pass RPN expression as one string as an argument or run without arguments for REPL. Calculator also has basic error handler.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
|
### Argument expression example
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
dotnet run "5 3 +"
|
dotnet run "5 3 +"
|
||||||
# >> 8
|
8
|
||||||
|
|
||||||
dotnet run "10 2 - 5 +"
|
dotnet run "10 2 - 5 +"
|
||||||
# >> 13
|
13
|
||||||
```
|
```
|
||||||
|
|
||||||
P.S.I still hate OOP, so code is rather imperative
|
### REPL examples
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
dotnet run
|
||||||
|
>> 5 3 +
|
||||||
|
8
|
||||||
|
>> 10 2 a +
|
||||||
|
... 2 a +
|
||||||
|
^ got unknown operator
|
||||||
|
>> 10 2 - * 5 +
|
||||||
|
... 2 - * 5 + ...
|
||||||
|
^ operator requires 2 arguments
|
||||||
|
```
|
||||||
|
|
||||||
|
P.S.I still hate OOP (don't know it well), so code improvements are welcomed
|
Loading…
x
Reference in New Issue
Block a user