Is Go a language I can use to create another programming language?

polaris · · 459 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>One of the C language&#39;s strengths has been that it can be used to create other languages with and indeed many languages are implemented in C. As a relative newcomer to Go and seeing it as an inheritor of the C mantle the question comes up: is Go a language I can use to create another programming language? Are there some advantages? For example, can I get get garbage collection for free since it&#39;s built in? Has anyone used Go to create other programming languages?</p> <hr/>**评论:**<br/><br/>boxyburn: <pre><blockquote> <p>Are there some advantages?</p> </blockquote> <p>Rob Pike did an interesting talk on <a href="https://www.youtube.com/watch?v=HxaD_trXwRE" rel="nofollow">lexical scanning in Go</a>. IIRC he mentions some features of Go that makes this sort of thing easier/nicer in Go.</p> <blockquote> <p>For example, can I get get garbage collection for free since it&#39;s built in?</p> </blockquote> <p>I suppose that depends on exactly what you&#39;re doing. If you&#39;re writing a compiler that outputs LLVM bytecode then there&#39;s no Go in there so you&#39;re not going to get the GC for free. But if you wrote a compiler that targets Go, or an interpreter, then you&#39;ll get free GC.</p></pre>abiosoft: <pre><p>There&#39;s one here <a href="http://ark-lang.org/" rel="nofollow">http://ark-lang.org/</a></p></pre>rjw57: <pre><blockquote> <p>is Go a language I can use to create another programming language</p> <p>Has anyone used Go to create other programming languages?</p> </blockquote> <p>Not &#34;other&#34; languages <em>per se</em> but Go is itself implemented in Go[1] and, obviously, Go is a programming language (;&gt;) so, yeah, Go can be used to implement programming languages at least as featureful as Go.</p> <p>[1] <a href="https://go-review.googlesource.com/#/c/5652/" rel="nofollow">https://go-review.googlesource.com/#/c/5652/</a></p></pre>BoTuLoX: <pre><blockquote> <p>Go is itself implemented in Go</p> </blockquote> <p>That is a bit of a lie however, since it relies on the Go 1.4 bootstrapping to provide primitives and such.</p></pre>rjw57: <pre><p>I&#39;m not sure I follow. Is it a then lie to say GCC is in C because it relies on a C compiler to be bootstrapped? Or that the Roslyn C# compiler is not written in C#?</p></pre>lolomfgkthxbai: <pre><p>I think what you meant to ask is &#34;Can I write a compiler in Go?&#34;. The answer is yes.</p></pre>ericbb: <pre><blockquote> <p>Has anyone used Go to create other programming languages?</p> </blockquote> <p>I&#39;ve written one interpreter, two compilers, and a virtual machine in Go.</p> <p>If you&#39;re mostly interested in learning about language development, then you might also want to take a good look at Racket because the Racket community has a strong focus on teaching and on language development. Haskell is also a great choice, for similar reasons.</p></pre>drvd: <pre><p>If you are seriously asking this question you will not be able to implement your own language without some heavy reading before starting coding. Really. </p></pre>

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

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