unifiedjs / ideas

Share ideas for new utilities and tools built with @unifiedjs

Home Page:https://unifiedjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elm AST

DamianReeves opened this issue · comments

Subject of the feature

Elm is a wonderful functional programming language.
We have found that Elm is a wonderful way to model business domains, in the spirit of Domain Modeling Made Functional.

I propose the addition of an Elm AST to unist.

This would allow to develop macros and transpilation to other languages (i.e. F# or OCaml).

Expected behaviour

Using something like elm-syntax we should get a unist style elm syntax tree.

This means we don't need a parser.

Alternatives

I've undergone this process outside of the unified ecosystem, but the unified ecosystem offloads many concerns that would otherwise need to be addressed.

commented

Awesome, yeah great idea! Want to work on this?

Would love to. Where/how do I get started?

commented

Something like this?

  1. Do you have a parser? Make sure it has positional info (has info on where things originated from)
  2. Get a syntax tree format going. As in, a clone of mdast, for elm
  3. Write something to convert the result of the parser to your Elm AST ($parsername-to-east)
  4. Figure out how to get that Elm AST into a string (east-to-string)
  5. Create the wrapper of the unified ecosystem (as in, a clone of the rehype project)

Thanks for starting the discussion @DamianReeves!
We're in the process unifying ideas in with discussions unifiedjs/collective#44
If you'd like to continue this thread, or start a new one https://github.com/unifiedjs/unified/discussions will be the home for ideas going forward.