tc39 / tc39/ecmarkup

Grammarkdown 2.2.5 new features may help with linting/diagnostics

Open
#260 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
245
Forks
80
Avg merge
10h 46m
Merged PRs (30d)
2

Description

@bakkot I've added a few features to grammarkdown that may be useful for ecmarkup linting:

  • Significant indentation gets reset after each grammarkdown top-level element is parsed
  • @define directives only apply to the lines that follow, and can be reset
  • New @line directives allow you to customize what grammarkdown reports for diagnostic messages

You can read more about them in the release info here: https://github.com/rbuckton/grammarkdown/releases/tag/2.2.5

In summary, the goal is that you could extract the entire grammar of an ecmarkup file into a single grammarkdown file for the purposes of checking/linting:

spec.html

<emu-clause id="...">
  <h1>Syntax</h1>
  <emu-grammar>
    Production :
      Nonterminal1
      Nonterminal2
  </emu-grammar>
  <emu-clause id="...">
    <h1>Static Semantics</h1>
    <emu-grammar>Production : Nonterminal1</emu-grammar>
  </emu-clause>
</emu-clause>

spec.html.grammarkdown (generated)

@line 4 "spec.html"
    Production :
      Nonterminal1
      Nonterminal2
@define noStrictParametricProductions true
@line 10 "spec.html"
                 Production : Nontermnal1
@define noStrictParametricProductions default

I'm also considering adding a way to make HTML transformations easier, possibly by adding an @ directive to specify an id attribute in the ecmarkup content generated by grammarkdown so that you might be able to leverage document.getElementById against the JSDOM generated by the output to extract the results.

I added most of these features to support changes I've been working on for my ecmarkup VSCode extension pet project in an effort to make my own life easier, and thought they might be helpful for ecmarkup itself as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the grammarkdown 2.2.5 release information and compare the spec.html and generated spec.html.grammarkdown examples. Determine whether ecmarkup should adopt these features for grammar extraction and linting, and define the integration entry point and acceptance criteria before implementation.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.