https://github.com/abargnesi/parser-combinators
Explore parser combinators.
https://github.com/abargnesi/parser-combinators
Last synced: 2 months ago
JSON representation
Explore parser combinators.
- Host: GitHub
- URL: https://github.com/abargnesi/parser-combinators
- Owner: abargnesi
- Created: 2025-02-03T15:14:14.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-03T17:06:06.000Z (4 months ago)
- Last Synced: 2025-02-03T17:34:59.198Z (4 months ago)
- Language: Java
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# parser-combinators
Exploring use of parser combinators in language modeling.
Carriage - Text Manipulation Language
(g-w :up)*
Concise shorthand for text manipulation.
## Input:
```
Here lies a paragraph to demonstrate Carriage.
Feature list:
- position-oriented editing
- token-based concepts
- action oriented functions
- user-defined functions
```## Examples:
Capitalize specific words.
Short:
```
(g-w :up)*
```Documented:
```
(
| Go to the next occurrence of hyphen(-) then to the next word(w).
g-w| Call :up function on word to capitalize.
:up| Match zero or more times.
)*
```---
Downcase each occurrence of `Carriage`.
Short:
```
(gw'Carriage' :dn)*
```Documented:
```
(
| Go to the next occurrence of Carriage.
gw'Carriage'| Downcase the word.
:dn| Match zero or more times.
)*
```PEG grammer:
```
Char <- \w
Literal <- "'" Char+ "'"
Num <- [0-9]+
```Blank space is not necessary but can be used for clear separation. It will be thrown away.