BOO的例子 7
基于boo这个语言实现的几个dsl例子,可以作为我们学习的参考
Brail
Castle Project
http://www.castleproject.org/monorail/documentation/trunk/viewengines/brail/index.html.
It’s a text templating language, built by me, in which in you can mix code and text freely. Here’s a sample:
<h1>My name is ${name}</h1>
<ul>
<% for element in list: %>
<li>${element}</li>
<% end %>
</ul>
Rhino ETL
Rhino ETL employs the concept of steps, with data flowing from one step to the next.
Usually the first step will extract the data from some source, and the last will load it to
the final destination.
Here’s an example of a full ETL process:
operationsplit_name:
for row in rows:
continue if row.Name is null
row.FirstName, row.LastName = row.Name.Split()
yield row
processUsersToPeople:
input "source_db", Command = "SELECT id, name, email FROM Users"
split_names()
output "destination_db", Command = """
INSERT INTO People (UserId, FirstName, LastName, Email)
VALUES (@UserId, @FirstName, @LastName, @Email)
""":
row.UserId = row.Id
This code gets the users list from the source database, splits the names, and then saves
them to the destination database. This is a good example of a DSL that requires some
knowledge of the domain before you can utilize it.
http://www.ayende.com/Blog/category/545.aspx
Bake (Boo Build System)
Task "init build dir":
if not Directory.Exists("build"):
MkDir "build"
CpFileSet("lib/*.dll").Files, "build", true
http://code.google.com/p/boo-build-system/
Specter
Specter is a behavior-driven development (BDD) testing framework
context "Empty stack":
stack as Stack
setup:
stack = Stack()
specifystack.Count.Must == 0
specify "Stack must accept an item and count is then one":
stack.Push(42)
stack.Count.Must == 1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2011-10-12 .net下作业调度实战[quartz]
2010-10-12 jQuery使用总结 - jQuery组成和主要功能 1/4