objj-transpiler

1.0.0-10 • Public • Published

ObjJAcornCompiler

A tiny, fast JavaScript and/or Objective-J transpiler with built in preprocessor. Written in JavaScript.

It uses a parser extended from the Acorn JavaScript parser by Marijn Haverbeke.

Preprocessor

The parser has a built in C like preprocessor.

Example:

#define MAX(x, y) (x > y ? x : y)
var m1 = MAX(a, b);
var m2 = MAX(14, 20);

Will be compiled to:

var m1 = a > b ? a : b;
var m2 = 14 > 20 ? 14 : 20;

For more info see this blogpost on the Cappuccino website.

Usage

    --module                        Set the source type to module instead of script in
                                    the parser.

    --ecma5, --ecma8, --latest      Sets the set version of ECMAScript used be the parser.

    --loose                         Sets the parser to use loose mode.

    --preserve-paren                Tells the parser to preserve parentheses, even if
                                    unnecessary.

    --strict-semicolons             ???

    --no-allow-trailing-commas      ???

    --track-comments                ???

    --include-comment-line-break    ???

    --include-comments              ???

    --track-spaces                  ???

    --track-locations               ???

    --no-objj                       Turns off the parsing of Objective-J.

    --no-preprocess                 Turns off the parsing of preprocessor directives.

    --silent                        ???

    --old-safari-bug                ???

    --no-code                       ???

    --ast                           Generates the intermediate AST as a JSON file.

    --source-map                    ???

    --no-debug-symbols              ???

    --no-type-signatures            ???

    --no-inline-msgsend             ???

    --indent-width                  ???

    --indent-string                 ???

    --indent-tab                    ???

    --output, -o

    -D                              ???

    --help                          ???

    -                               ???

Limitations

It can't compile Objective-J code that depends on other Objective-J files. The Objective-J load and runtime is needed for this. But it will work as long as you declare any superclass in the same file.

Package Sidebar

Install

npm i objj-transpiler

Weekly Downloads

6

Version

1.0.0-10

License

none

Unpacked Size

437 kB

Total Files

6

Last publish

Collaborators

  • mrcarlberg
  • alfredwarnsater