我愿意开始将我的语言嵌入到 Helvetia,但我真的不知道从哪里开始。几周前,我使用 Petit Parser 编写了解析部分。我想嵌入类似于以下的代码,例如 Helvetia 页面中的 sql 示例:
main ()
{
Put(Red)
Move(North)
}
我期待一些比 Helvetia 示例更简单的指南:P
There are various examples included with the distribution of Helvetia that do exactly what you are asking for and that you might want to study:
Cutie-Helvetia-Automaton
uses the low-level Helvetia infrastructure to integrate an automaton language defined in CUAutomatonGrammar
.
Cutie-LanguageBoxes-SQL
uses the high-level language boxes infrastructure to embed SQL defined in LBSqlGrammar
into Smalltalk.
你可以调查一下
http://scg.unibe.ch/research/helvetia
特别是 SCG 链接中关于 Language Boxes (6) 和 Embedding Languages without broken tools (&) 的出版物更详细地解释了如何使用 helvetia