commonmark / commonmark/cmark

Consider writing scanners by hand

Open
#167 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2k
Forks
691
Avg merge
1d 16h
Merged PRs (30d)
1

Description

Currently we generate a number of scanners from regexes using re2c.

This has two advantages:

  1. It is easy to see at a glance what the scanners do, and easy to modify them.
  2. The scanners generated are DFAs and should perform well. Since re2c is well tested, this also lowers testing burden.

Disadvantage: Either we require re2c as a build dependency, or we have to ship a gigantic scanners.c file.

Should we simply hand-write the scanners and dispense with re2c and scanners.re?

Contributor guide

No contributing guide indexed for this repository

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 by reading scanners.re, the generated scanners.c, and the build configuration that invokes re2c. Compare the generated scanner behavior and build tradeoffs with a hand-written alternative. Done means reaching and documenting a project decision about whether to remove re2c and how scanner sources should be maintained.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, tooling
Issue type
Refactor
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.