yjbanov / butterfly

A web framework for Dart based on Flutter's widget model
Apache License 2.0
156 stars 13 forks source link

JSX like dsl for butterfly widgets #5

Closed jonahwilliams closed 7 years ago

jonahwilliams commented 7 years ago

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:

Please take a look and we can discuss

yjbanov commented 7 years ago

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.

yjbanov commented 7 years ago

Decided to not pursue for now.