New: regular expressions
Pattern matching is now possible with the regex type. The syntax is what is used in Javascript, so that it executes natively in the browser. The MATCH statement has been added, making it possible to use SWITCH with a string and use a regex:
SWITCHtext
}
MATCH"[A-Z][a-z]+"; capword = text
MATCH"[0-9]+"; number = text
New: testing support
If your tests are in MyModule_test.zu you can run them with:
zimbu test MyModule_test.zu
Zimbu presentation on T-Dose
The video of the presentation is now available on youtube.
Recently changed
Zimbu Templates (ZUT) is the new way of creating a web page or a UI for your application. You create your page with HTML and CSS, like a web page, and then add Zimbu code for the interactivity. The same templates can be used on the server and on the client. This means rendering can be done on the server. Listening on events is very simple. Have a look in the zutdemo directory for examples. It is still incomplete, but you can see how it works. Also see the ZUT specification and the ZUT module documentation.
The CTX library provides dependency injection. An object that is added to the context can be used in a method down the call stack, without explicitly passing it as a method argument. This is used for ZUT.Context in Zimbu templates.
Zimbu examples
The Hello World program: hello.zu:
FUNC Main() int
IO.print("Hello, World!")
RETURN 0
}
Larger examples:
An overview of special features of Zimbu on the highlights page.
The biggest existing Zimbu program is the Zimbu compiler itself. You can browse the code here.
Install and run Zimbu
Download a snapshot or clone the Mercurial repository from bitbucket.org/zimbu/zimbu
For instructions see the Getting Started page.
Discuss Zimbu
The maillist is here: http://groups.google.com/group/zimbu-discussStatus
- The language is somewhere between a "proof of concept" and version 1.0.
- The compiler can compile itself and most programs. The examples on this site run properly.
- Not all parts of the language have been implemented and there are a few bugs and hacks.
- This website has useful info but is still incomplete, much more to follow.
Why Zimbu?
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.
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.
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, do not 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, minimize "stop the world" garbage collection.
- 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
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)
- also produce Javascript, so that Zimbu code can be run in a web browser.
- mainly use static type checking, also support runtime type checking
- object oriented, all data is handled like an object, but there also are simple types
- support for functional programming, with callbacks and lambda methods
- an import defines one symbol, this avoids name conflicts in large projects
- the standard modules and classes are available without an import statement
- many modules are part of the language, no need for third party libraries
- all keywords are in capitals, you can use all other names without worrying about the next version breaking your program