yjbanov/butterfly

JSX like dsl for butterfly widgets

Closed this issue · 2 comments

In branch parser_concept I have a simple (read: hacked together) concept for a JSX like transpiler for flutter widgets. Run tool/transpiler.dart some_input.dx.dart to generate some_input.dart.

Some open questions:

  • How should the API of element be adjusted to accommodate the syntax?
  • Should we use the analyzer to build the transpiler?
  • Naming or file convections? currently using .dx.dart
  • Dx(...) as a top level function, where does it live.

Please take a look and we can discuss

How should the API of element be adjusted to accommodate the syntax?

What's missing? At this stage of the project the sky is the limit. Let's change it.

Should we use the analyzer to build the transpiler?

I really hope the translation is pure AST transformation. We should try to avoid resolving imports and such, so we only need the parser. Therefore it doesn't really matter what we use to parse. Analyzer is probably the easiest. We can switch to fasta or whatever the hot new Dart front-end is when it's ready.

Naming or file convections? currently using .dx.dart

.dx.dart works for me. At some point we should consider the implications of hand-editing .dx.dart files but importing .dart files. Maybe not be a big deal? Probably ok if the generated files are hidden somewhere. We'll sync with bazel/build team when/if this becomes important.

Dx(...) as a top level function, where does it live?

package:butterfly/butterfly.dart

The branch LGTM. Let's merge.

Decided to not pursue for now.