Related articles |
---|
Tao3D, a new open source language for real-time 3D animation christophe.de.dinechin@gmail.com (Christophe de Dinechin) (2014-10-30) |
From: | Christophe de Dinechin <christophe.de.dinechin@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Thu, 30 Oct 2014 15:46:03 -0700 (PDT) |
Organization: | Compilers Central |
Keywords: | available, functional |
Posted-Date: | 30 Oct 2014 21:04:33 EDT |
Taodyne just released Tao3D "Libre Edition", a GPLv3 version of Tao3D.
http://www.taodyne.com/shop/dev/blog/292-tao3d-libre-edition.
WHAT IS TAO3D?
Tao3D is a functional reactive programming language designed specifically for
real-time 3D animations. It lets you create sophisticated presentations very
quickly.
WHY IS IT RELEVANT TO COMP.COMPILERS?
Tao3D is implemented using a few ideas that might spark some interest on
comp.compilers.
1) A homo-iconic source code format that remains readable.
Homoiconic languages like Lisp are often relatively hard to read for humans.
Tao3D uses a parse tree format that is very simple yet can represent
practically any source code in a relatively natural way.
Specifically, there are 8 node types: integer, real, text, name, infix,
prefix, postfix and block. The first four are terminals as well as leafs in
the parse tree. The last four are inner nodes, and represent the way humans
perceive a specific operation. "Infix" represents "A+B" or "A and B". "Prefix"
represent "+3" or "sin x". "Postfix" represent "3%" or "3km". Finally, "Block"
represent (A) or [A] or {A}. Blocks are used to represent indentation. Infix
are used to represent line separators.
Like in Lisp, the parse tree is also the fundamental data structure at
runtime.
2) A compilation strategy based on tree rewrites
A single operator, ->, which reads as "transforms into", is used to define
functions, operators, variables and macros / syntactic structures.
// X transforms into 0: Defines X as a variable
X->0
// Define a factorial function
0! -> 1
N! -> N * (N-1)!
// Define an 'if-then-else'
if true then X else Y -> X
if false then X else Y -> Y
3) A reactive approach for dynamic events
Tao3D is reactive, meaning that the program automatically reacts to events and
updates accordingly. For example, you can have a circle that follows the mouse
with the following program:
color "red"
circle mouse_x, mouse_y, 100
This automatically create a mouse-based animation. More examples are given in
the article linked at the beginning of this post.
4) A real-time code generation using LLVM
Tao3D uses LLVM to dynamically generate code on the fly as you change its
source code. This is not new per se, but if you are interested in this kind of
things, this is an example of code that can teach you how to do it.
BUILD INSTRUCTIONS
git clone https://github.com/c3d/tao-3D.git
cd tao-3D
git submodule update --init --recursive
./configure
make install
Fork me on GitHub, and enjoy.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.