Andy Arvanitis edited this page Jul 27, 2013 · 4 revisions

Eero to Objective-C translation (source-to-source)

Eero is implemented with a fork of the LLVM/Clang compiler. It thus generates binaries directly, and can be used with all LLVM/Clang tools, including source-level debugging, static analysis, etc.. However, it is also possible to have the compiler convert Eero source code to Objective-C source code. This can be done via the command line as follows:

$ {eero-bin-location}/clang -eero-to-objc mycode.eero

This will generate a file named mycode.m by default. To specify other output files, use the -o switch:

$ {eero-bin-location}/clang -eero-to-objc myeerocode.eero -o myobjccode.m

Redirecting to stdout is also possible, and useful for piping output to something like a beautifier:

$ {eero-bin-location}/clang -eero-to-objc myeerocode.eero -o /dev/stdout

Finally, headers can also be converted. However, if the compiler can't determine the language from the input file extension, it must be specified:

$ {eero-bin-location}/clang -x eero -eero-to-objc myeeroheader.h -o myobjcheader.h

Running the output through a code beautifier (formatter)

clang-format is included with all recent Eero builds.

These examples assume {eero-bin-location} is in your path and eero is a link/alias for its clang version.

Piping the output from the translator directly to clang-format:

$ eero -eero-to-objc mycode.eero -o /dev/stdout | clang-format -style=google > mycode.m

Formatting all converted files in a given directory:

$ clang-format -i *.m *.h


  • There is currently no code beautifier built in, so the translator will attempt to preserve indentation and symbol placement. This will likely result in code that is not optimally "pretty" (especially w.r.t. curly braces), so running the output through a source code formatter tool is recommended (such as clang-format mentioned above).

  • Some macros can confuse the translator. Work is ongoing to address this.

  • This feature is considered beta-level, so bugs are likely. Please report any found in the issues tool.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.