Awesome
Kt2Dart
This is a transpiler which consumes Kotlin codes and convert them into Dart.
I made some CodeWars Katas inspired from this repo:
Why Kt2Dart
Because I want to Make Flutter Great Again.
Flutter, written in Dart, is an awesome mobile developing framework. But Dart is too weak, for the dynamic typing and null-unsafety.
Kotlin is much more powerful. If we can combine the beautiful flutter and the powerful/safe Kotlin, our world will be peaceful forever.
Also, since your dart codes are transpiled from Kotlin, you can use Sound Dart
(the term Strong Dart
refers to the same thing) compiler to compile the generated Dart codes.
You may find it better to use Kotlin's JavaScript mode (to enable the use of the dynamic
type).
Limitations
Kt2Dart supports full-featured Kotlin (because I write this parser according to the strict grammar definition),
but I will not add any support for transpiling:
- Extensions
- Labels (label break/continue, label return)
import as
- Anonymous Classes
if
andwhen
as expressions- Typed closures (dart's closure type
Function
is not generic) - Desctructing declaration (
{ (a: Int, b: Int): Pair<Int, Int> -> xxx }
)
While these features are not fully supported:
- Naming (names like System.`in` are transpiled into
System.in
directly) - Generics (Dart's generics are covariant)
Such (advanced) language features of Kotlin are too complex to transpile (it needs too much analyzing while Kt2Dart is just a simple tool).
And this tool will raise warnings as comments when these stuffs are detected.
Why Haskell
Yeah, as you see, I'm using Haskell in this project.
Because Parser Combinators are easy and convenient I want to practise my Haskell skills.
I'm a beginner to Haskell, so if you find any naive code, feel free to tell me (by issuing or mailing) (I'm using hlint).