https://github.com/nblumhardt/tcalc
A series of C# parser construction examples
https://github.com/nblumhardt/tcalc
csharp parsers superpower
Last synced: over 1 year ago
JSON representation
A series of C# parser construction examples
- Host: GitHub
- URL: https://github.com/nblumhardt/tcalc
- Owner: nblumhardt
- License: apache-2.0
- Archived: true
- Created: 2018-09-10T00:38:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-03T01:50:07.000Z (about 7 years ago)
- Last Synced: 2025-02-09T04:03:48.669Z (over 1 year ago)
- Topics: csharp, parsers, superpower
- Language: C#
- Size: 1.28 MB
- Stars: 39
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `tcalc`
A series of C# parser construction examples, using [Superpower](https://github.com/datalust/superpower).
This repository implements a toy language for simple calculations over durations expressed
in days (`d`), hours (`h`), minutes (`m`), seconds (`s`), or milliseconds (`ms`), along with floating point numbers:
```
tcalc> (1h - 50m) * 3
00:30:00
tcalc> 7d / 350ms
1728000
```
The `master` branch implements this as a token-driven parser. You can also view the parser expressed as a pure-text
parser by switching to the [`text-parser` branch](https://github.com/nblumhardt/tcalc/tree/text-parser).