又来两种编译到 JS 的语言
发布于 12 年前 作者 jiyinyiyong 4905 次浏览 最后一次编辑是 8 年前

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 回复

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

其乐无穷呗

重复造轮子是成长之路

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

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

回到顶部