爱编码的Farmer

  • 主页
  • 编程开发
  • 运营维护
  • 随心笔记
  • 留言页面
  • 打赏
爱编码的Farmer
我是Farmer,我为自己代言
  1. 首页
  2. 未分类
  3. 正文

你知道么?不止有CNM语言

2015年2月4日 2354点热度 0人点赞 0条评论

道(Dao)语言是一个轻量级、支持类型标注和众多高级特性的程序语言。 它对基于多核的并行编程有良好的支持。 它的C编程接口简单易用,方便嵌入或扩展。

主要特性:

  • 支持可选类型标注,类型推导和静态检查;
  • 支持基于类和接口的面向对象编程;
  • 支持代码块方法(替代函数式方法);
  • 对并行编程有内置的原生支持;
  • 有并行的基于垃圾回收的内存管理;
  • 支持带类型检查的协程;
  • 支持闭包,匿名函数和类;
  • 有类BNF语法宏系统;
  • 设计和实现为基于寄存器的虚拟机;
  • 使用跨平台的标准C实现;
  • 有简单易用的C编程接口,方便嵌入或扩展;
  • 有基于LLVM的及时编译器;
  • 有基于Clang的自动封装工具;
  • 使用简化的BSD许可发布。

更完整的特性列表:help:dao.feature 。

下面这个简单的例子展示了Dao语言多方面的特性:

# 类型别名:
type Address = tuple<number:int,street:string>

# 带有显示参数类型的函数:
routine Rout( name : string, index = 123 ) => int 
{
    io.writeln( name, index )
    return 123 
}
Rout( 'abc' )

class InheritanceBase
{
    var  address : Address = ( 123, 'Main St' )
}
class MixinBase { var name = 'Joe' }

# 定义一个包含MixinBase,并继承InheritanceBase的类:
class Klass ( MixinBase ) : InheritanceBase
{
    static state : enum<off,on> = $off
}
someone = Klass()

# 闭包:
closure = routine( x ){ io.writeln( x ) } 
for( i = 1 : 5 ) defer { closure( i ) }

routine Producer( chan : mt::channel<int> )
{
    for( index = 1 : 10 ) chan.send( index )
    chan.cap(0)
}
routine Consumer( chan : mt::channel<int> )
{
    while(1){
        data = chan.receive()
        if( data.status == $finished ) break
    }
}
chan = mt::channel<int>(2)
Producer( chan ) !!  # 开始生产者tasklet;
Consumer( chan ) !!  # 开始消费者tasklet;

# 并行的代码块方法:
mt::apply( [1.0:100], 4 ){[x] log(x) }
草泥马编程语言只是恶搞,但是DAO语言看看这目录你就看到慢慢的霸气...
ALL--| 
     |--dao-----| dao: 道(Dao)程序设计语言(版本2.0) (203.2 KB)
     |          |--guide--------| dao.guide: 快速简明指南 (27.0 KB)
     |          |--data---------| dao.data: 常量,变量和定变量 (5.3 KB)
     |          |               |--const---| dao.data.const: 常量 (0.7 KB)
     |          |               |--var-----| dao.data.var: 变量 (0.9 KB)
     |          |               |--invar---| dao.data.invar: 定变量 (2.0 KB)
     |          |               |--static--| dao.data.static: 静态变量 (1.2 KB)
     |          |                            
     |          |--type---------| dao.type: 数据类型和类型标注 (72.9 KB)
     |          |               |--bool-----| dao.type.bool: 布尔类型 (0.3 KB)
     |          |               |--int------| dao.type.int: 整数类型 (0.6 KB)
     |          |               |--float----| dao.type.float: 单精度浮点数类型 (0.5 KB)
     |          |               |--complex--| dao.type.complex: 复数类型 (0.5 KB)
     |          |               |--enum-----| dao.type.enum: 枚举符号类型 (5.0 KB)
     |          |               |--string---| dao.type.string: 字符串类型 (24.6 KB)
     |          |               |--array----| dao.type.array: 数值数组类型 (6.4 KB)
     |          |               |--list-----| dao.type.list: 列表类型 (12.9 KB)
     |          |               |--map------| dao.type.map: 关联表类型 (7.5 KB)
     |          |               |--tuple----| dao.type.tuple: 元组类型 (1.7 KB)
     |          |               |--variant--| dao.type.variant: 多型(Variant)类型 (3.3 KB)
     |          |                             
     |          |--operator-----| dao.operator: 运算符 (7.7 KB)
     |          |               |--arithmetic---| dao.operator.arithmetic: 算术运算符 (0.7 KB)
     |          |               |--comparison---| dao.operator.comparison: 比较运算符 (0.9 KB)
     |          |               |--logic--------| dao.operator.logic: 逻辑运算符 (0.3 KB)
     |          |               |--bitwise------| dao.operator.bitwise: 比特运算符 (0.4 KB)
     |          |               |--assignment---| dao.operator.assignment: 赋值运算符 (2.1 KB)
     |          |               |--typecast-----| dao.operator.typecast: 类型转换操作符 (0.3 KB)
     |          |               |--misc---------| dao.operator.misc: 其它运算符 (2.4 KB)
     |          |               |--overloading--| dao.operator.overloading: 运算符重载 (0.1 KB)
     |          |                                 
     |          |--control------| dao.control: 控制结构 (8.6 KB)
     |          |               |--if-else------| dao.control.if-else: If-Else条件控制 (2.8 KB)
     |          |               |--for----------| dao.control.for: For循环控制 (2.6 KB)
     |          |               |--while--------| dao.control.while: While循环控制 (0.9 KB)
     |          |               |--do-while-----| dao.control.do-while: Do-While循环控制 (0.7 KB)
     |          |               |--switch-case--| dao.control.switch-case: Switch-Case控制 (1.3 KB)
     |          |                                 
     |          |--routine------| dao.routine: Routine 函数 (14.3 KB)
     |          |               |--closure----| dao.routine.closure: 匿名函数和函数闭包 (3.0 KB)
     |          |               |--section----| dao.routine.section: 代码块方法 (3.8 KB)
     |          |               |--decorator--| dao.routine.decorator: 修饰器函数 (6.0 KB)
     |          |                               
     |          |--class--------| dao.class: 面向对象编程的类 (13.0 KB)
     |          |               |--definition---| dao.class.definition: 定义 (4.2 KB)
     |          |               |--inheritance--| dao.class.inheritance: 类的继承 (1.5 KB)
     |          |               |--operator-----| dao.class.operator: 操作符重载 (1.5 KB)
     |          |               |--mixin--------| dao.class.mixin: 组件类 (0.7 KB)
     |          |               |--decorator----| dao.class.decorator: 修饰器类 (2.9 KB)
     |          |               |--aspect-------| dao.class.aspect: 方面类 (1.9 KB)
     |          |                                 
     |          |--interface----| dao.interface: 抽象接口 (1.8 KB)
     |          |--defer-error--| dao.defer-error: 延迟代码块和错误处理 (11.2 KB)
     |          |--concurrent---| dao.concurrent: 并行计算编程 (9.2 KB)
     |          |               |--threading----| dao.concurrent.threading: 多线程模块 (3.0 KB)
     |          |               |--async-call---| dao.concurrent.async-call: 异步函数调用 (0.8 KB)
     |          |               |--async-class--| dao.concurrent.async-class: 异步类 (1.5 KB)
     |          |               |--channel------| dao.concurrent.channel: 通讯管道 (3.3 KB)
     |          |                                 
     |          |--builtin------| dao.builtin: Built-ins (4.2 KB)
     |          |               |--math-------| dao.builtin.math: Built-in Math Functions (3.3 KB)
     |          |               |--exception--| dao.builtin.exception: Exception Types (1.0 KB)
     |          |                               
     |          |--module-------| dao.module: Module Loading (2.9 KB)
     |          |               |--std--| dao.module.std: Built-in Standard Module (0.6 KB)
     |          |               |--io---| dao.module.io: Built-in IO (Input/Output) Module (1.1 KB)
     |          |               |--mt---| dao.module.mt: Built-in Multi-threading Module (1.1 KB)
     |          |                         
     |          |--grammar------| 
     |                          |--notation----| dao.grammar.notation: Dao语言文法标记 (0.9 KB)
     |                          |--lexical-----| dao.grammar.lexical: Lexical Structures (7.3 KB)
     |                          |--constexpr---| dao.grammar.constexpr: Constant Expressions (3.5 KB)
     |                          |--typename----| dao.grammar.typename: Type Name (3.1 KB)
     |                          |--expression--| dao.grammar.expression: Expressions (4.0 KB)
     |                          |--statement---| dao.grammar.statement: Statements (4.0 KB)
     |                          |--routine-----| dao.grammar.routine: Routines (Functions) (1.1 KB)
     |                          |--class-------| dao.grammar.class: Class (0.4 KB)
     |                                           
     |                            
     |--module--| 
     |          |--core------| 
     |          |            |--macro--| module.core.macro: 语法宏 (0.0 KB)
     |          |            |--aux----| module.core.aux:  (0.0 KB)
     |          |                        
     |          |--standard--| 
     |                       |--math--| module.standard.math:  (0.0 KB)
     |                       |--meta--| module.standard.meta:  (0.0 KB)
     |                       |--jit---| module.standard.jit: System Dependent Core Functions (0.0 KB)
     |                                  
     |                         
     |--daovm---| daovm: 道虚拟机(版本2.0) (33.7 KB)
     |          |--interface-----| daovm.interface: 使用Dao的C语言接口编程 (33.7 KB)
     |          |                |--embedding--| daovm.interface.embedding: 嵌入道虚拟机 (7.8 KB)
     |          |                |--extending--| daovm.interface.extending: 扩展道虚拟机 (26.0 KB)
     |          |                                
     |          |--architecture--| daovm.architecture: The architecture of the Dao Virtual Machine (0.0 KB)
     |                           |--vmspace------| daovm.architecture.vmspace: Virtual Machine Space (0.0 KB)
     |                           |--namespace----| daovm.architecture.namespace: Namespace (0.0 KB)
     |                           |--class--------| daovm.architecture.class: Class (0.0 KB)
     |                           |--routine------| daovm.architecture.routine: Routine (0.0 KB)
     |                           |--process------| daovm.architecture.process: Virutal Machine Process (0.0 KB)
     |                           |--instruction--| daovm.architecture.instruction: Virtual Machine Instructions (0.0 KB)
     |                                             
     |                             
     |--help----| help: 在线帮助模块 (0.0 KB)
     |          |--method--| 
     |                     |--help----| help.method.help: help() (0.0 KB)
     |                     |--search--| help.method.search: help.search() (0.0 KB)
     |                     |--load----| help.method.load: help.load() (0.0 KB)
     |                     |--list----| help.method.list: help.list() (0.0 KB)
     |                                  
     |                       
     |--tool----| tool: Dao Tools (0.0 KB)
                |--standard--| tool.standard: Standard Dao Tools (0.0 KB)
                             |--clangdao--| tool.standard.clangdao: ClangDao for Automatic Wrapping (0.0 KB)

                        
标签: 暂无
最后更新:2015年2月5日

9u

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据。

COPYRIGHT © 2021 icodef.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

湘ICP备19008073号