d-plaindoux / celma Goto Github PK
View Code? Open in Web Editor NEWLibrary for generalised parser combinators and a dedicated meta-language in Rust
License: Apache License 2.0
Library for generalised parser combinators and a dedicated meta-language in Rust
License: Apache License 2.0
Since the Celma parser produces an AST we are able to traverse it in order to optimize the produced parser. This can be done by computing the first(s) element in order to have a more predictive parser removing try
and backtracks.
rust doc should be written.
First of all, thanks for the work. Especially the macro, really making char to char consuming more clear (meaningful).
While I was reading the README, one thing I did not quite get. What do those alters mean?
I guess ^
means "not any", !
means "not all". But I have no idea what does #
mean.
For example, in this parsec rule let STRING:{String} = ('"' c=#((("\"" -> {'\"'})|^'"')*) '"') -> {mk_string(c)}
, I assuming that it consumes the whole string of "something"
. If I want to stop when next char is double quote, but leave it in the stream?
Parsing with Not
is not possible at all. The compilation fails.
First of all, I do not know if this is Celma issue, or just how proc macro works.
When I make parsec_rules, I write '\"'
in code. Then use cargo expand
. The expanded code contains '\"'
as expected.
But when I write "\""
, the expanded code is "\\\""
.
--> ~/src/Git/celma/core/src/parser/lookahead.rs:54:21
|
54 | Success(a, _, ba) => Success((), s, ba),
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
= note: `#[warn(unused_variables)]` on by default
Celma supports generic streams. The Celma parser metalanguage should be generalized and not only reduced to input like a stream of chars.
The lookahead should be implemented in
For example, bash variable substitution. The input is written as "This is ${prog_name} speaking"
. In my opinion, it should be parsed into something like [PLAIN("This is "), VAR("prog_name"), PLAIN(" speaking")]
. But when I write the plain parser, I could not figure out how to "consume any chars until string '${'".
The current implementation requires the same type for the negated parser and the result.
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.