/tacoscript

:taco: The bidirectional alt-JS language

Primary LanguageJavaScriptMIT LicenseMIT

Build Status Waffle.io Stories Join the chat at https://gitter.im/forivall/tacoscript

An es2015+-isomorphic altjs language, with syntax inspired by CoffeeScript, Python, Ruby, and frappe, and architecture inspired by Babel.

What does it mean that this language is "es2015+-isomorphic"?

TacoScript shares its Abstract Syntax Tree (AST) with JavaScript, using the same format as Babylon. This means that, for any valid JavaScript code, there is an exact, lossless version of that code in TacoScript, and vice versa: For all valid TacoScript code, there is an exact translated representation in JavaScript. Currently, whitespace will not always be preserved; eventually, whitespace will also be preserved.

Unlike CoffeeScript, TacoScript actually is, 100%, just JavaScript.

So, if it is just JavaScript, why does this exist? For the same reason that there are both British English and American English: Some people just prefer different conventions.

And also to experiment with new syntax that won't or can't be an ECMAScript proposal. (so Babel won't support them).

Packages

(In Progress)

Command line tools. Currently includes repl, compose, transpose, compile, and node commands.

Parses TacoScript into an AST/CST. Uses the same tree format as Babylon, deviating where necessary.

import * as horchata from "horchata"
ast = horchata.parse(code, options)

Adds CST sourceElements to an existing JavaScript / Babylon / estree CST.

(Previously tacoscript-generator)

Generates TacoScript code from a Babylon AST/CST.

import generate from "tacotruck"
code = generate(ast, options, originalSourceCode)

(Not Implemented)

Converts a JavaScript AST with CST elements to a TacoScript CST, which preserves whitespace. Inverse of alpastor.

(In progress)

Converts a TacoScript AST's CST elements to JavaScript CST elements, which then can be output as JavaScript code that preserves the whitespace present in the TacoScript code. Inverse of taqueria

AST translator (transpiler / detranspiler) core.

comal (noun) /koˈmal/ - A flat, pan-like clay or metal griddle used to cook tortillas or other foods.

tacoscript-eslint

(Not Implemented)

Transforms a TacoScript AST so that it can be checked by ESLint.

tacoscript-implicit-return-function

(In Progress, needs generator and transforms)

AST transformations for implicitly returning functions ("sharp arrows").

(In Progress, needs generator and transforms)

AST transformations for this.@ shorthand.

(In Progress, needs generator and transforms)

Parser & Generator plugins and AST transformations for and= and or=.

Could also include an acorn plugin for parsing ||= and &&= in javascript.

tacoscript-auto-const-extern

(Not Implemented)

Parser & Generator plugins for extern declarations. Required by any auto-const plugins, or if anyone creates an auto-let or CoffeeScript-style auto-var alternative plugin.

tacoscript-auto-const-statement

(Not Implemented)

AST transformations for automatic const variables when assignment is a statement. (Spec).

tacoscript-auto-const-expression-simple

(Not Implemented)

AST transformations for automatic const variables in restricted expression forms. (Spec).

tacoscript-auto-const-full

(Not Implemented)

AST transformations for automatic const variables anywhere forms. (Spec). May create ugly JavaScript code.

(In Progress, needs generator) Parser & Generator and transformations for iife's created with the with keyword syntax.

Example:

with= {bar: foo, boop: beep} > bar + boop

tacoscript-negative-conditional

(Not Implemented)

Parser & Generator plugins and AST transformations for unless and until.

tacoscript-useful-modulo

(Not Implemented)

Parser & Generator plugins and AST transformations for %%.

tacoscript-fluid-comparison

(Not Implemented)

Parser & Generator plugins and AST transformations for a < b < c, etc.

tacoscript-negative-binary-keywords

(Not Implemented)

Parser & Generator plugins and AST transformations for not instanceof, not in (, not of).

tacoscript-universal-fat-arrow

(Parsing complete, generator and transformations ready to start)

AST transformations and verification for using the fat arrow (=>) in any function definition situation, for lexical binding of this and arguments. Uses horchata's lexicallyBoundNamedFunctions feature parsing option.

tacoscript-asbool

(Not Implemented)

Parser & Generator plugins and AST transformations for !! (not not) to asbool.

tacoscript-binary-of

(Not Implemented)

Parser & Generator plugins and AST transformations for of binary operator.

tacoscript-soak

(Not Implemented)

Parser & Generator plugins and AST transformations for soak member expressions: ?. and ?[.

tacoscript-null-coalescing-op

(Not Implemented)

Parser & Generator plugins and AST transformations for the null coalescing operator: a ? b.

tacoscript-null-coalescing-assign

(Not Implemented)

Combination of tacoscript-logical-assign and tacoscript-null-coalescing-op.

tacoscript-typeof-null-is-null

(Not Implemented)

Parser & Generator plugins and AST transformations so that in TacoScript, typeof null === "null".

tacoscript-safe-switch

(Not Implemented)

Parser & Generator plugins and AST transformations for the non-fallthrough switch variant.

tacoscript-double-strudel-class-member

(Not Implemented)

Parser & Generator plugins and AST transformations for @@ shorthand operator.

tacoscript-dynamic-super

(Not Implemented)

Allow super in any (i.e. non-class) function, and translate super() to this.constructor.super_.call(this) and super.foo() to this.constructor.super_.prototype.foo.call(this)

The super_ convention is codified in util.inherits.

tacoscript-generic-template-string

(Not Implemented)

tacoscript-multiline-string

(Not Implemented)

tacoscript-multiline-regex

(Not Implemented)

tacoscript-boolean-switch-statement

(Not Implemented)

tacoscript-boolean-switch-expression

(Not Implemented)

tacoscript-auto-label

(Not Implemented)

Parser & Generator plugins and AST transformations for automatic labels for long breaks: break for, etc.

tacoscript-conditional-catch

(Not Implemented)

Parser & Generator plugins and AST transformations for conditional catch clauses.

tacoscript-rescue

(Not Implemented)

Parser & Generator plugins and AST transformations for rescue blocks for functions, for simplified error handling.

tacoscript-conditional-rescue

(Not Implemented)

Combines tacoscript-conditional-catch and tacoscript-rescue.

tacoscript-incremental-for-loop

(Not Implemented)

Parser & Generator plugins and AST transformations for upto, below, downto, above and by in for loop headers

tacoscript-literate

(Not Implemented)

Parser & Generator plugins for literate mode.

tacoscript-comprehensions

(Not Implemented)

tacoscript-ranges

(Not Implemented)

tacoscript-operator-overloading

(Not Implemented)

tacoscript-block-break

(Not Implemented)

tacoscript-variable-declaration-expressions

(Not Implemented)

tacoscript-git-magic

(Not Implemented)

Git hooks to automatically create an equivalent history in git as if a JavaScript project was written in TacoScript, and to therefore seamlessly contribute to JavaScript projects by coding in TacoScript, and vice-versa.