Official Elm Syntax?

Is there an official place that documents Elm’s syntax? I imagine the names and structures from the compiler are a good start, but has that info been turned into a document format?

Related: How were the module names chosen for stil4m/elm-syntax? Are the names based off the compiler’s internal modules or some other place?

The official syntax guide is here: http://elm-lang.org/docs/syntax

It’s not like a EBNF grammar, but it will get you going. What are you doing that you need to parse Elm source? There may be a better solution if we know what problem you’re trying to solve at a higher level. :slight_smile:

Ah ha! That term led me to this page which seems to be along the lines of what I’ve been looking for (though this was not expressed in my question)

I’ve considered a few projects that would benefit from being able to effectively parse Elm source code, though nothing has really left the “idea” stage yet. I think the next step for each of those projects is learning about Elm’s syntax.

Now, if stil4m/elm-syntax closely adheres to “spec”, that should suffice for most of my projects for the time being (most of my imaginary projects would be web-based applications).

There’s an old(er) thread about Lesser-known syntax that has some useful pieces of information.

Have you see this package?

http://package.elm-lang.org/packages/Bogdanp/elm-ast/latest

I’ve played around with it and it mostly works but I found a few cases of valid code that it wouldn’t parse. So it’s not an exact replica of the real compiler’s parser.

Yes, that’s a really cool thread. It does have some neat tricks :slight_smile:

Nice, I had not! I’ll have to compare that package with elm-syntax.