CNode

又来两种编译到 JS 的语言

Jjiyinyiyong发布于14 年前最后回复14 年前6 回复5702 浏览0 收藏

Little Smallscript http://ympbyc.github.com/LittleSmallscript/

| Animal Snake sam |

Animal := Object subclass.

Animal method: [:name | 
  this at: #name put: name
] at: #init.

Animal method: [:metres |
  window alert: ([@name](/user/name) + 'moved ' + metres + 'm.')
] at: #move.

Snake := Animal subclass.
Snake method: [
  "'super' is not supported yet"
  window alert: 'Slithering...'.
  self move: 5
] at: #crawl.

sam := Snake new: 'Sammy the Python'.
sam crawl

six https://github.com/matthewrobb/six

// Arrow Function
[ 1, 2, 3 ].forEach( item => print(item) )

// Egal Operators
if(x isnt y && y is z) { }

// Classes
class Person {
  constructor(name) {
    this.name = name
  }
  greet() {
    print("Hello, my name is " + this.name + ".")
  }
}

// Quasi Literals / Template Strings
var me = new Person("Matthew")
print(`Hello, my name is ${me.name}.`)

List of languages that compile to JS https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

没完没了...

查看回复

回复 (6)

J
j4cnodejs#1·14 年前

这个世界的新朋友, 就是在没完没了地重复地造轮子

G
gxmari007#2·14 年前

其乐无穷呗

J
jiyinyiyong#4·14 年前
引用 j4cnodejs这个世界的新朋友, 就是在没完没了地重复地造轮子

大家都是冲着 JS 杀过去的 :P 我也好想那么玩啊, 自己造一门能实用的 JS 方言, 那就帅了

J
j4cnodejs#5·14 年前
引用 j4cnodejs这个世界的新朋友, 就是在没完没了地重复地造轮子

@jiyinyiyong 都编译成javascript ,那以后javascript岂不成了伪汇编语言?

参与回复
登录后即可参与回复。登录