KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
Parser-Gombinators
★ 15
Open GitHub ↗
Simple Parser Combinators in Go
Download README (.md)
Explore Similar Repositories
QQJoinGroup
:
qq加群机器人,根据配置的关键词来搜索群并自动发送加群验证。难点:list滚动需要跨进程模拟触屏事件。使用前提:需要获取root权限,如需要获取更多机型的支持,需要添加相应机型的模拟触屏实现类。本项目不再维护,只提供给个人开发者学习使用。
spring-boot-elasticache-redis-tutorial
:
Building a Spring Boot 2.x application utilizing Redis for caching
quizair
:
Node Express MongoDB Parcel Preact PWA hosted on herokuapp.com
img-to-webp-spring-service
:
A Java Library to easily convert images to WebP, a Spring REST-Service for devs that uses the lib and an user-friendly Web UI for everyone else.
Hands-on-Application-Development-with-React-and-Bootstrap
:
Hands-on Application Development with React and Bootstrap, published by Packt
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
Parser-Gombinators
?
Download (.md)
# Parser-Gombinators Simple Parser Combinators in Go This library implements simple parser combinators in the Go programming language. Parser combinators allow you to parse texts of many deterministic context-free languages. Parser combinators are designed to make the parser code mimic the grammar. **Avoid left-recursion!** **Avoid overlapping prefixes in alternatives!** The following grammar for primary school arithmetic expression satisfies the above two constraints. ``` Multiplicand := Number | "(" Expression ")" Adddend := Multiplicand (("*" | "/") Multiplicand)* Expression := Addend (("+" | "-") Addend)* ``` Using Parser-Gombinators the source code of the parser reads almost like the grammar itself. ```go func Multiplicand (input ParserInput) ParserResult { return ExpectNumber.Convert(atoi).OrElse ( expect ("(").AndThen (Expression).AndThen (expect (")")). First().Second()) (input) } func Addend (input ParserInput) ParserResult { return Parser (Multiplicand).Bind (func (firstResult interface{}) Parser { return expect ("*").OrElse (expect ("/")).AndThen (Multiplicand). RepeatAndFoldLeft (firstResult, multiply) }) (input) } func Expression (input ParserInput) ParserResult { return Parser (Addend).Bind (func (firstResult interface{}) Parser { return expect ("+").OrElse (expect ("-")).AndThen (Addend). RepeatAndFoldLeft (firstResult, add) }) (input) } ``` See the calculator example for the full source code.