The syntax transpiler for the ObjectiveScript programming language.
Include ob.js
in your environment. This might, for example, entail using <script src>
, require()
, or -[JSContext evaluateScript:]
.
OBJSTranspiler.transpile(source: string, minify: boolean = false): { code: string; map: string; }
Parameters:
source
: The input source code written in ObjectiveScriptminify
: A flag which determines whether to minify the output
Returns:
code
: The generated JavaScript code, compatible with the ObjectiveScript runtimemap
: A source map representing the entire transformation
OBJSTranspiler.tokenize(source: string): Iterable<acorn.Token>
Parameters:
source
: The input source code written in ObjectiveScript
Returns: An Iterable
of tokens
Start by running npm install
to set up the dependencies.
Run npm run driver
to see the output of transpiling test/app.objs
without having to compile the full ob.js
file.
Note: At present, the minify
parameter cannot be used during iteration because that involves building uglify.js
which is an artifact created while performing a full build.
Use npm run build
to perform a full build. The output will be the ob.js
file at the root level of the repository.
Execute npm test
to run the test suite.
Note: Test coverage is currently low, so the results are not a very strong indicator of regressions.
Execute npm run clean
.