Introducing Gryphon, the Swift to Kotlin translator

Hi all, I've just published the first full version of a program I've been working on for over three years now.

It's called Gryphon, and it translates Swift code into Kotlin code.

This is the first version where all features are working:

  • The generated Kotlin code works the same as the Swift code it came from, no edits needed. There's an automated test that makes Gryphon translate its own source code, with around 12k lines, and ensures the translation passes all the same tests as the original executable.
  • There's a templates system that's used to automatically translate many standard library types and methods.
  • Xcode integration, with Xcode showing any warnings or errors raised by the Kotlin compiler next to the Swift lines that originated them, so users can fix them at the source.
  • The output code is readable, which is useful for minimizing the risks for new users. If Gryphon isn't the right fit for them, they're left with a Kotlin codebase they can keep maintaining.

This list of features isn't to say there aren't any bugs, of course - I'm doing my best to keep track of them and fix them on a daily basis.

I'd encourage anyone interested to watch the video and check out the documentation on the website. There are a lot of very interesting challenges that come with trying to translate Swift to another language correctly - problems with reference vs. value types, exceptions, control flow, performance, etc. I look forward to talking about this with the community and hopefully getting some help with development.

Any questions, comments, or feedback in general is welcome.

19 Likes

Oh I almost forgot! There's a video too. I'll include it in the original post.

1 Like