Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A language that compiles down to pure javascript

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 SweetTea.gemspec
README.md

SweetTea

SweetTea is a language that compiles down to javascript, similar to coffeescript.

Syntax

Classes

Empty Class
// SweetTea
class-> MyClass
<-class

// JavaScript
var MyClass = (function() {
  function MyClass() {}
  return MyClass;
})();
Class Init
// SweetTea
class-> MyClass
  function-> init arg1 arg2
    var-> someVar = "value"
  <-function
<-class

// JavaScript
var MyClass = (function() {
  function MyClass(arg1, arg2) {
    var someVar = "value";
  }
  return MyClass;
})();
Class Variables
// SweeTea
class-> MyClass
  variable-> myVar = "Hello World"
<-class

// JavaScript
var MyClass = (function() {
  function MyClass() {}
  MyClass.prototype.myVar = "Hello World";
  return MyClass;
})();

Class Functions
// SweetTea
class-> MyClass
  function-> myFunction <-function
<-class

// JavaScript
var MyClass = (function() {
  function MyClass() {}
  MyClass.prototype.myFunction = function() {
  };
  return MyClass;
})();

Functions

Empty Function
// SweetTea
function-> myFunc <-function

// JavaScript
var myFunc = function() {
};
Function with arguments
// SweetTea
function-> myFunc arg1 arg2 arg3 <-function

// JavaScript
var myFunc = function(arg1, arg2, arg3) {
};

Variables

Empty Variable
// SweetTea
var-> myVar

// JavasScript
var myVar = null;
Variable with value
// SweetTea
var-> myVar = "Hello"

// JavaScript
var myVar = "Hello";

Data Types

// Strings
"I am a String"

Note: Strings are currently the only data type

Aliases

// Classes
class->
c->

// Functions
function->
func->
f->

// Variables
variable->
var->
v->

License

All code in this project is licensed under MIT which can be found in the LICENSE file or at this url http://www.opensource.org/licenses/MIT

Something went wrong with that request. Please try again.