projectfluent / fluent

Fluent — planning, spec and documentation
https://projectfluent.org
Apache License 2.0
1.4k stars 45 forks source link

Semantic Comments rev 1 #180

Open zbraniecki opened 5 years ago

zbraniecki commented 5 years ago

Hi,

I'm starting a new issue to unify the work toward semantic comments. The first revision will mainly follow #139 and #140, but I'd like to design it to be ready for future extensions.

I wrote a very basic tooling parser which I fully expect to be rewritten, but I hope that the AST and tests will allow us to discuss the exact behavior and feature set that we want out of it.

Here's the branch: https://github.com/zbraniecki/fluent.js/tree/sem-comments-1

I also attempted to write some EBNF, but again, I more see it as a step toward unifying out shared agreement on how the semantic comments should work and expect it to require a full rewrite.

The ebnf is here: https://github.com/zbraniecki/fluent/blob/semantic-comments/spec/comments.ebnf

@stas - can you take a look at the AST, tests and EBNF? And can you help me set the scaffolding for the reference parser please? :)

Pike commented 5 years ago

General comments:

We commonly read the grammars eagerly, so if a production is Text | Foo, you'll never get to Foo.

I think we would say "Paramater has a Variable", not "Variable is a Parameter". I don't think that Parameter has a name?

Should semantic comments be multi-line? Or is single-line all we want?

Not really exhaustive, just trying to keep the ball rolling (and pretend that I read all the things.)

stasm commented 5 years ago

@stas - can you take a look at the AST, tests and EBNF? And can you help me set the scaffolding for the reference parser please? :)

I'll try to get to this early next week.

(PS. it's @stasm 👋.)

stasm commented 5 years ago

Thanks for your patience, @zbraniecki. I have an idea on how to lay out the directories in the repos to make room for semantic comments. It involves a few file renames. We currently have a number of PRs open with the 0.8 changes and I'd prefer to avoid conflicts. Let's wait for them to land (which I hope happens this week for most of them) and then I'll be happy to help here.