Replies: 1 comment 6 replies
-
I'm glad you're enjoying Participle. Have you been through the tutorial? If you do that you should have basically all of the steps necessary to create a parser for this structure, particularly as you already have it in an EBNF-style form. Basically each of the rules should end up being a struct. The start of the grammar would look something like this: type Graph struct {
Spans []*Span `(@@ ("," @@)*)?`
}
type Span struct {
Start *Vtx `@@`
Edge []*Edge `@@+`
}
type Edge struct {
Kind string `@("-" "-"? | "~" "~"? | "=" )`
End *Vtx `@@`
}
... The default lexer should be sufficient I believe but will return individual characters for punctuation, never runs of characters. The parser only matches exact tokens. So |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi friends and @alecthomas, very impressive work! First allow me to say thanks for gifting it to the world. I love Go and projects like these remind of me of why. :)
I'm leading development of an exciting particle physics project that will be presented a number of research institutions including the LHCb in the coming year, and
participle
seems like a great fit to handle queries from users (particle physicists) into our package. I'm getting the hang of it, but using participle would go way faster if I had help with a starting point for a simple stateless expr language:Basically, this is a language to express a graph, such as:
string
Some nice-to-haves:
Once parsed, we would then walk each Graph, perhaps something like:
We will be unveiling the project in about 2 months and it will be GPL3. We would love to shoutout to
participle
and publicly acknowledge it. This is a passion project and are not getting paid, so any help would be greatly appreciated.Hugs,
Drew
Beta Was this translation helpful? Give feedback.
All reactions