<p>I'm looking for a parser generator, that can take an existing antlr or bnf grammar and generate lexer/parser in golang for that. My google-fu doesn't work really well for this topic.</p>
<p>Thanks!</p>
<hr/>**评论:**<br/><br/>j_Bugman: <pre><p>Antlr has a Go backend, try it</p></pre>wjkohnen: <pre><p>The Go target was released with ANTLR version 4.6 end of last year. It is still new-ish and feedback is welcome. </p></pre>ericzhill: <pre><p>I just finished a toy calculator to get my head around it. You need to be careful with identifiers and first letter casing because generated code may not be published when you want it to be. Beyond that, the generated event handler is a nice touch, so that you can <del>inherit</del> <em>embed</em> it inside your own struct and only create the methods you want to use.</p>
<p>Edit: <a href="/u/dchapes" rel="nofollow">/u/dchapes</a>, corrected
The documentation (for Go specifically) is lacking, so just keep trying. It does work.</p></pre>dchapes: <pre><p>s/inherit/embed/</p></pre>PaulCapestany: <pre><p>Direct link to the <a href="https://github.com/antlr/antlr4/blob/master/doc/go-target.md" rel="nofollow">Go Antlr README</a></p></pre>bear1728: <pre><p>I've used <a href="https://godoc.org/golang.org/x/tools/cmd/goyacc" rel="nofollow">goyacc</a> with some success. I had to learn more about yacc to use it, but it worked. Also I had to write my own lexer, but that wasn't hard for my particular grammar. Rob Pike has a <a href="https://www.youtube.com/watch?v=HxaD_trXwRE" rel="nofollow">video</a> about lexical scanning in Go that could also help.</p></pre>tv64738: <pre><p>Please use a subject like "Looking for ..." in the future for this kind of a post.</p></pre>drsect0r: <pre><p>RemindMe! One Week</p></pre>RemindMeBot: <pre><p>I will be messaging you on <a href="http://www.wolframalpha.com/input/?i=2017-07-13%2015:41:40%20UTC%20To%20Local%20Time" rel="nofollow"><strong>2017-07-13 15:41:40 UTC</strong></a> to remind you of <a href="https://www.reddit.com/r/golang/comments/6lkw3q/parser_generator_for_antlr_or_any_bnf_grammar/djuw5hn" rel="nofollow"><strong>this link.</strong></a></p>
<p><a href="http://np.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps://www.reddit.com/r/golang/comments/6lkw3q/parser_generator_for_antlr_or_any_bnf_grammar/djuw5hn%5D%0A%0ARemindMe!%20%20One%20Week" rel="nofollow"><strong>CLICK THIS LINK</strong></a> to send a PM to also be reminded and to reduce spam.</p>
<p><sup>Parent commenter can </sup> <a href="http://np.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete!%20djuw5y5" rel="nofollow"><sup>delete this message to hide from others.</sup></a></p>
<hr/>
<table><thead>
<tr>
<th><a href="http://np.reddit.com/r/RemindMeBot/comments/24duzp/remindmebot_info/" rel="nofollow"><sup>FAQs</sup></a></th>
<th><a href="http://np.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLINK%20INSIDE%20SQUARE%20BRACKETS%20else%20default%20to%20FAQs%5D%0A%0ANOTE:%20Don't%20forget%20to%20add%20the%20time%20options%20after%20the%20command.%0A%0ARemindMe!" rel="nofollow"><sup>Custom</sup></a></th>
<th><a href="http://np.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders!" rel="nofollow"><sup>Your Reminders</sup></a></th>
<th><a href="http://np.reddit.com/message/compose/?to=RemindMeBotWrangler&subject=Feedback" rel="nofollow"><sup>Feedback</sup></a></th>
<th><a href="https://github.com/SIlver--/remindmebot-reddit" rel="nofollow"><sup>Code</sup></a></th>
<th><a href="https://np.reddit.com/r/RemindMeBot/comments/4kldad/remindmebot_extensions/" rel="nofollow"><sup>Browser Extensions</sup></a></th>
</tr>
</thead><tbody>
</tbody></table></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传