ragel+goyacc example (Excel Formula Evaluation)

agolangf · · 704 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I want to eventually add support for creating Pivot tables in my xlsx/docx/pptx library gooxml. A precursor to that is implementing an Excel formula evaluator to allow creating a pivot table from possibly computed values. I&#39;ve finished implementing an evaluator as well as support for around 100 common Excel functions (e.g. SUM, IF, etc.). It&#39;s not 100% compatible with Excel, but there are several hundred test cases on non-trivial formulas and it should easily handle evaluating the vast majority of commonly used spreadsheet formulas. </p> <p>If you&#39;ve ever wanted to implement a parser in go with Ragel &amp; goyacc, I think this may serve as a good example of one way to approach it. The code is at <a href="https://github.com/baliance/gooxml/tree/master/spreadsheet/formula">https://github.com/baliance/gooxml/tree/master/spreadsheet/formula</a></p> <ul> <li>lever.rl Ragel input</li> <li>grammar.y goyacc input</li> </ul> <hr/>**评论:**<br/><br/>siwu: <pre><p>Thanks a lot, this a part of Go that&#39;s rather obscure to most people and it&#39;s great to see it used outside the Go repo itself.</p></pre>baliance: <pre><p>There&#39;s also a more simple Ragel/Go example at <a href="https://github.com/baliance/gooxml/tree/master/spreadsheet/format" rel="nofollow">https://github.com/baliance/gooxml/tree/master/spreadsheet/format</a> There I use Ragel to create a lexer for Excel&#39;s number format strings (e.g. &#34;0&#34;,&#34;$#,##0&#34;, &#34;dd-mm-yy&#34;, etc.) to allow retrieving a value from a spreadsheet as Excel would display it. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

704 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传