Comments (8)
Thanks @vityafx this does seem like it'd be a really nice addition. I'll see what I'm able to figure out and keep you posted.
from bnf.
@vityafx I think exposing the AST would be a very valuable part a feature like this. I plan on incorporating that too, thanks for bringing it up! As far as timeline for progress on this work / series of features, it's likely that it'll be pushed back until January.
from bnf.
If I'm understanding correctly, this might be a way to analyse input that conforms to the parsed grammar?
Yes.
Then we parsed an input string ATCGT, what would you expect to get back?
Yes.
I am not sure (it was many years ago), however, I think it was something like that:
<dna> --> "ATCGT"
|
|--------- <base> -------> "A"
|--------- <dna> -------> "TCGT"
|--------- <base> -------> "T"
|--------- <dna> -------> "CGT"
|--------- <base> -------> "C"
|--------- <dna> -------> "GT"
|--------- <base> -------> "G"
|--------- <dna> -------> "T"
|--------- <base> -------> "T"
So, the idea is to see how the data entered by the user fits the grammar, what rules and how are satisfied.
I would also suggest to make output be supported in different formats - in a human-readable one and in, for example, json, because if anyone wanted to create a gui for it, he would need it.
from bnf.
Ah! Thanks for this suggestion! If I'm understanding correctly, this might be a way to analyse input that conforms to the parsed grammar?
Maybe you could help clarify the output. As a very simple example, if we used the dna grammar from the REAMDE:
<dna> ::= <base> | <base> <dna>
<base> ::= "A" | "C" | "G" | "T";
Then we parsed an input string ATCGT
, what would you expect to get back?
Something like this?
<dna> -->
<base> <dna> -->
<base> <base> <dna> -->
<base> <base> <base> <dna> -->
<base> <base> <base> <base> <dna> -->
<base> <base> <base> <base> <base>
from bnf.
Just noticing, it would also be nice to have a possibility to navigate through them, not only see the output. For example, I am remembering the university course for implementing lisp
in rust
, so I wanna create a translator scheme
-> rust
to be used by rustc
directly. I know the grammar but if I already have a parser which can be done by this issue, it will also be nice to navigate trough the rules and be able to build the ast and then use it (I will probably just convert it to rust
ast and feed the rustc
with it).
from bnf.
Time flies like an arrow! I kicked around some work on building an out Earley parser on top of bnf, it seems like a promising solution but I don't know if I'm going to be able to incorporate anything anytime soon. Would welcome anyone who wants to take a stab.
from bnf.
@vityafx The implementation for this has made it to the main branch, a release is being drafted now and will be published later today.
Wowie, it was a long time coming!
from bnf.
Indeed! I'll check out, thanks!
from bnf.
Related Issues (20)
- 2 Questions about Parsing HOT 5
- Empty String Rules Fail to Match HOT 4
- Empty String Rules (Still) Fail to Match HOT 7
- faster production matching while earley parsing
- reusable grammar parser
- Nullable productions (Still, Still) Fail to Match HOT 6
- Right-recursive productions Fail to Match
- Broken coverage report HOT 6
- report the faulty character / line / column / offset when no parse trees are generated HOT 3
- draft releases via Github Actions HOT 1
- Manually update dependabot's recommendations HOT 2
- Support BNF Variants HOT 3
- How to parse a certain text according to a bnf grammar and get a list of token HOT 8
- Rethink Grammar::generate logic HOT 5
- Generate code coverage reports as a step in our GitHub actions HOT 1
- Nullable Rules?
- suggestion: extract bnf test-cases to their own .bnf files? HOT 3
- Ability to parse BNF grammars at compile time HOT 3
- Iterator::size_hint
- Include README.md as documentation in lib.rs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bnf.