Updated readme: added REPL and errors examples

This commit is contained in:
Dmitriy Shishkov 2021-08-08 21:26:25 +03:00
parent 7ef2c86ce6
commit 6a17551d5c
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060

View File

@ -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