sargunv / cakeparse Goto Github PK
View Code? Open in Web Editor NEWSimple parser combinator library for Kotlin
License: Apache License 2.0
Simple parser combinator library for Kotlin
License: Apache License 2.0
This is still on Gradle...
I'm trying to use cakeparse to write the grammar for my shell, https://github.com/cbeust/kash and I can't seem to define a simple grammar to allow either "and" commands:
a && b && c
or "pipe" commands:
a | b | c
Here is what I have, in short:
val andCommand = singleCommand and zeroOrMore(andAnd and singleCommand)
val pipeCommand = singleCommand and zeroOrMore(pipe and singleCommand)
val goal = andCommand or pipeCommand
With that goal, I can only parse one of these two lines but never both.
Am I missing something?
I may be doing something wrong, but I get a stack overflow when I do the following:
val number = token("number", "[0-9]+")
val space = token("space", "\\s+")
val goal = oneOrMore(number before optional(space))
val input = "557196 56123\n".repeat(5000)
println(input)
val lexed = setOf(number, space).lexer().lex(input).cached()
println("lexed")
val result = lexed.parseToEnd(goal).value
println("Result: $result")
When using what's suggested in the docs: compile "me.sargunvohra.lib:CakeParse:1.1.1"
gradle gives me a ModuleVersionNotFoundException
, but that's easily solved by using lowercase instead. I don't know if this is OS related, specific to the gradle version I use, or just an error in the docs.
I use Window 10 and Gradle 3.3
Need to write tests for:
Check both pure lexing and also lexing + parsing
This will be useful for interactive programs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.