cough-syrup

0.0.1 • Public • Published

CoughSyrup is a shallow fork of CoffeeScript.

Installation

If you have the Node Package Manager installed:

npm install -g cough-syrup

Leave off the -g if you don't wish to install globally.

Getting Started

Execute a script:

cough /path/to/script.cough

Compile a script:

cough -c /path/to/script.cough

Comparison of CoffeeScript and CoughSyrup

The original CoffeeScript source code has been minimally modified, mainly so that CoughSyrup more closely resemble Scheme and Haskell.

The current changes to the code allow

  1. interposition of spaces between functional identifiers and CALL_START tags;

  2. recognition of implicit left-associative function calls (i.e., function calls in applicative order without explicit parentheses or CALL_START/CALL_END tags);

  3. use of backslashes to indicate the beginning of one-parameter parameter lists;

  4. use of the pattern '\i \j \k ->' to indicate currying (i.e, this pattern is rewritten as '(i) -> (j) -> (k) ->');

  5. use of semicolons to toggle between applicative and point-free compositional order (i.e, 'f g h' is equivalent to 'f(g)(h)', whereas if 'k = ; f g h', then 'k(0)' is equivalent to 'f(g(h(0)))');

  6. use of additional characters (e.g., '-', '?', '!') in INDENTIFIERs' names (To accommodate this change, the four existential operators, each of which were formerly represented by '?', have been modified: INDEX_SOAK is now '|'; the binary existential operator is now '??'; and FUNC_EXISTS and the unary existential operator now precede their operands.);

  7. use of the backtick to immediately compose a pair of functions when in applicative mode and to immediately apply the first of a pair of functions on the second when in compositional mode -- that is,

  • '; f `g h ;' is interpreted as '(i) -> f(g(h)(i))' and
  • 'f `g h j' is interpreted as 'f((i) -> g(h(i)))(j)'

Package Sidebar

Install

npm i cough-syrup

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mhilty