Giter VIP home page Giter VIP logo

def's Introduction

Def

Def Logo

Def 是新一代基于虚拟机的开源通用编程语言,拥有 C 的简捷语法和 Lisp 的强大表现力。

Def 支持多范式、反射、元编程、函数式、垃圾回收等高级特征。通过强大的独一无二的处理器语法,让 Def 成为“可编程的编程语言”,甚至在运行时期改变程序行为。运用其精简直观的语法,可快速构建出模块化、易重构、可读性强的应用程序。

 

>>> 链接

 官方网站  \  快速开始  \  文档手册  \  下载

 

>>> 使用

下载 Def 虚拟机(可执行文件):

  Windows : def-win64.exe
  Linux : def-linux64
  OS X : def-osx64

你也可以下载源码自行编译得到 Def 虚拟机。通过执行 build文件夹下的编译脚本,通过支持 C++11 标准的编译器编译。

打开命令行,切换带虚拟机可执行文件所在目录,执行 def -c 便可输入 Def 脚本,回车运行并得到结果。或者输入 def hello.d 执行 Def 脚本文件。

 

>>> 代码示例

# 变量定义
num : 100
word : "hello " + "world !"

# 列表
list : (1 2 3 4 5)

# 字典
dict : [
  'name'   "def lang"
  'number' (1 2 3)
]

# 容器访问
list[3] # 3
dict['name'] # def lang

# 函数定义
fn add(a b)
  a + b
;

# 函数调用
add(1 2) # 3

# 处理器定义(遍历容器)
def foreach{con k v}
	arr : evaluat(con) # 执行取值
	ii  : size(arr)
	i   : 1
	while i<=ii
		assign(k i)
		assign(v arr[i])
		j  : 4
		jj : size(_argv_)
		while j<=jj
			evaluat(_argv_[j]) # 执行循环体
			j : j+1
		;
		i : i+1
	;
;

# 处理器调用
con : ("def" 2015 12.5)
foreach{ con k v
  print(v) # 打印每一项
}

 

>>> 其它

本项目采用 MIT 协议。

作者:杨捷
邮箱:[email protected]

def's People

Watchers

James Cloos avatar ifzz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.