[新闻] Vim作者创造新编程语言Zimbu

yntcsb 2009-11-11
开源文本编辑器Vim的作者Bram Moolenaar推出了新的编程语言Zimbu,一种不拐弯抹角直截了当的实验性编程语言。Moolenaar表示Zimbu集现有语言的优点于一身,同时避开它们的不足。Zimbu代码清晰易读,使用范围广泛——既能写OS kernel,又能写脚本,还能写大的GUI程序,可以编译和运行在几乎所有系统上。Zimbu代码托管在Google Code上,采用Apache License 2.0许可证。
betty_betty2008 2009-11-11
yntcsb 写道
开源文本编辑器Vim的作者Bram Moolenaar推出了新的编程语言Zimbu,一种不拐弯抹角直截了当的实验性编程语言。Moolenaar表示Zimbu集现有语言的优点于一身,同时避开它们的不足。Zimbu代码清晰易读,使用范围广泛——既能写OS kernel,又能写脚本,还能写大的GUI程序,可以编译和运行在几乎所有系统上。Zimbu代码托管在Google Code上,采用Apache License 2.0许可证。

D NG上前些日子有人提到过Zimbu,颇多赞誉,可俺上不去官网。
有链接吗?
cjbbug 2009-11-11
不知道有WINDOWS版吗
flyingxu 2009-11-11
Suppose you want to write a new program, something like a text editor.  What language would you write it in?
It has to be as fast as possible, so interpreted languages are out.
You don't want to micro manage memory, so C is out.
You don't want to require programmers to have a degree, so C++ is out.
You want fast startup and not depend on a big runtime, so Java is out.
It has to run on most systems, anything with a C compiler, so D is out.
You want to have fun making something new.
No existing language really meets these demands, so let's create a new one that does.


Zimbu is an experimental programming language.  It is a very practical, no-nonsense kind of language.  It mixes the good things of many existing languages and avoids their deficiencies.  And then throws in a few brand new ideas.
flyingxu 2009-11-11
Goals
More on the Goals page.

easy to read back - code is read N times more often than it is written
avoid common mistakes - make it difficult to write bad code (but you can write hacks if you really want to)

keep it short and clear, don't state the same thing twice - no header files, don't repeat type specs

the effect of a statement should be predictable and not depend on something in another file

efficient execution: no startup delay, reasonable memory use - no Just In Time compiler effects

support a wide range of applications - Zimbu can be used to write an OS kernel, a short script and a big GUI application

portable - be able to compile and run on almost any system
many standard data types, modules and classes - most things you need are already there
flyingxu 2009-11-11
Want to try it out?
Download a snapshot from code.google.com/p/zimbu
This also includes the todo list and more design choices.

Examples
Hello World program: hello.zu:


MAIN()
  IO.write("Hello, World!\n")
}



Notes:

The entry point to the program is the MAIN() function.
Keywords are in capitals, this avoids the problem that you need to know all keywords when picking a name.  And it allows for adding keywords later without breaking an existing Zimbu program.

The IO module contains I/O stuff.  IO.write() writes to stdout.  IO.stdout.write() would do the same.  In Zimbu things that you use often are kept short.  The long form is available for consistency.

The IO module is part of the language, no need to import it, we know where it is.
"\n" is a newline character. String escape characters are used like in C and Java.  There also is IO.writeLine() which appends the newline character.

There is no semicolon to end a statement.

The } character is used to end a block.  There is no {, we know where the block starts.  This avoids useless discussions about where to put the {.
flyingxu 2009-11-11
Choices
Main choices made so far (more on the design page):

convert the program to C and use the C compiler to produce machine code (could be something else later)

mostly use static type checking, also allow runtime type checking
object oriented, all data is handled like an object, but there also are individual functions

code files can contain one module and several classes, organize packages in directories; an import defines one symbol

the standard modules and classes are available without imports, avoids boring work
many modules are part of the language, they work the same way everywhere

all keywords are in capitals, you can use all other names without worrying about the next version breaking your program
flyingxu 2009-11-11
Status
The compiler can compile itself and run a few tests.  The examples below run properly.

The source code includes too many hacks for public viewing (embarrassment factor).
This website is incomplete, much more to follow.
betty_betty2008 2009-11-11
下了今天的snap-shot,不会整啊!

从哪里开始下手?WINDOWS下,俺现有Mingw32 V3.4.5,还有VC6,还有LCC-WIN32。
梁利锋 2009-11-11
有点儿看不习惯没有左大括号,却有右大括号的语法。。。
Zimbu至少有一点挺好的,就是zimbu的编译器就是zimbu写的。
而D的编译器是C写的,也就使作者失去了一个很好的实际使用D的机会。
Global site tag (gtag.js) - Google Analytics