[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

A new language which compiles to javascript

Simeon Chaos

7/14/2014 3:40:00 AM

## the declaration to release Taijilang

This is the season when new languages are coming into the world. In March, Facebook released Hack; In June, Apple released the Swift.

Today, July 13, 2014, the closing date of the 2014 World Cup in Brazil, I (Caoxingming, assumed name Taiji Zhenren) announced the first release of Taijilang.

Let it go, let's start the game of throne, to write a song of ice and fire in Taijilang.

### Project Address:
[github: github.com/taijiweb/taijilang](https://www.github.com/taijiweb...)

[npm: npmjs.org/chaosim/taiji](https://www.npmjs.org/pac...)

[google groups: taijilang](https://groups.google.c...!forum/taijilang)

[G+: taiji lang](https://plus.google.com/u/0/114446069949044102399/p...)

install:
* npm install taijilang
* npm install -g taijilang

###introduction

Taijilang is a new general powerful programming language, with flexibility, good readability, ease of use. Taijilang will have more customizability and scalability than all other existing programming languages.

In general, the features of Taijilang can be summed up: more powerful macro than in lisp, more important white space than in the indentation syntax of python, more general preprocess than in C, broader meta compilation than metalua, more flexible dialect feature than rebol, more optimized object code than in coffee-script. Listed below are the specific features of Taijilang:

* Compiled to javascript language:

Taijilang may expand to use other languages as the target language in the future.

* Flexible friendly syntax

Taijilang have fine and flexible syntax control, e.g. indentation grammar and other kind of use of white spaces to help the reading; spaces can change the precedence of operators; flexible multi-line strings in which the programmer can control interpolation, escaping freely, and so on

* Everything are expressions

Similar to CoffeeScript, assignment, if, switch, while, for statement are all expressions. Further, in Taijilang, return, break statement has also been treated as expressions. Less distinction between statements and expressions will give us greater freedom to organize the program, which I fully understood while I develop the parser for Taijilang with coffee-script, it is exactly because of the syntax features of treating assignment and function definition in coffee-script language that I was inspired to find a new method to write parser by hand, which is the key to the dynamic parser of Taijilang (see the [peasy project](https://www.github.com/cha... ) ).

* Macro

Based on quasi quoted list, Taijilang have macro simliar to lisp. Combined with a friendly, extendable dynamic syntax, macro in Taijilang becomes even more powerful than lisp.

/. "/." starts an indent block comment, which stops until meeting an undent.
taijilang implements macro in lisp style, but with different symbol in accordance with traditional grammar, e.g.
"~" equal to "'" in lisp, "`" is the same as in lisp, ^" eqaul to "," in lisp, "^&" equal to ",@" in lisp
// below is a macro definition
// line comment can lead a indented code block
// do is a predefined keyword, we add \ before it to escape the meaning
\do #= (body..., clause) -=>
if clause[0]=='where' then
`{let ^&(clause.slice(1)) then ^&body}
else if clause[0]=='when' then
`{doWhile! ^clause[1] ^&body}
else if clause[0]=='until' then
`{doWhile! not(^clause[1]) ^&body}
// now the code below becomes valid:
do
print a
print b
where a=1, b=2
i = 0; do print i++ until i==10

* Meta Language

Any expression can be evaluated at compile time to control the compilation process and object code. This is similar to preprocess the C language, but more general. The macro and meta-language features can greatly improve expressionability, and help to write more optimized software.

// #1+2 and #3+4 is evaluated in compiling time:
if 1 then #1+2 else #3+4
// the condition of "if" statemeng is evaluated in compiling time
// when the condition is true, "then" clause is compiled, else "else" clause is compiled.
// this is similar to the #if in C language.
# if 1 then 1+2 else 3+4
// different from the above sample, the whole "if" statement below is evaluated in the compiling time
## if 1 then 1+2 else 3+4
* Most customizable and extensible language, with the help of dynamic parser, macro and meta language features

Taijilang syntax can be customized and extended from the multi-level, including the re-definition of grammatical elements, define new operator expressions, set a new operator, and so on. Any keywords and symbols in Taijilang can be redefined by macros or functions. below is some samples:

// Taijilang use ? as an attribute prefix to access the parser,
// use ?? and ?/ to evaluate in the parsing time, if use ?/, the prefix ? can be omitted.
?? ?cursor() // put the current parsing position to the compiled code
?? ?clause(), print 1 // all parser.clause() to parse the following code
?/ clause(), print 1 // call parser.clause() to parse the following code

* Modulization

Different from most other languages compiled to javascript, Taijilang have its own modular system.

The programmers can organize programs by modules and packages, and release libraries or frameworks in Taijilang.

* Optimized object code
Contrast to other languages (such as coffee-script) compiled to javascript, Taijilang completely avoids generating closure function and function call while transforms expressions to javascript construct; delete operation which has no effect; do recursion optimization, including but not limited to tail recursion optimization on((see samles/let.tj), and so on.

Language is the carrier of thinking, and impact thinking greatly. Taijilang is a natural result of my understanding of programming languages. Before developing Taijilang, I had been already committed to the study of natural language programming for many years. I explored a variety of linguistic theory and natural language processing technology. I began to try to design and implement new programming language from 2007, and I in-depth study and compare a variety of different style programming language, compiler theories, technologies and projects, working on the kernel of compiler and parsing algorithm, at last I have Taijilang as a result of integrating of such works and projects.

Released the first time today, the version number is 0.1.0. Currently Taijilang have passed nearly 800 tests. Of course, it is inevitable to have bugs.. At the moment Taijilang is short of documentation seriously, but there are some sample programs. Therefore, the current motto is: Luke, look the source code! The programmers who have a strong heart, the hackers who are willing to step on the holes, the prawns who dare to be the first one to eat the crab, all of you are welcome to Taijilang. Any questions, advices, etc, please contact Taiji Zheren (taijiweeb@gmail.com).