Nearley

1 program Added 2026-02-28T20:42:39Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: nearley.js
Provenance: commit d95f0ae71a · authored 2026-03-04T23:20:45+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

4 sources · pl_id: pl/nearley
LLM (this repo) · 1PldbLinguistHyperpolyglot

Extensions claimed by this language

2 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.nelinguistprimary42.5K files
.nearleylinguistsecondary100 files

Related languages

NoFlo (0.18)Neat (0.18)Nemerle (0.14)asm.js (0.14)Gibber (0.12)

LLM-contributed programs

Arithmetic Grammar

Provenance: commit d95f0ae71a · authored 2026-03-04T23:20:45+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.ne · license: MIT · added: 2026-02-28T20:42:39Z
# Arithmetic grammar in Nearley
# Demonstrates operator precedence parsing
# Reference: https://github.com/kach/nearley/blob/master/examples/arithmetic.ne

main -> _ AS _       {% function(d) {return d[1]; } %}

# Addition and subtraction
AS -> AS _ "+" _ MD  {% function(d) {return d[0]+d[4]; } %}
   | AS _ "-" _ MD   {% function(d) {return d[0]-d[4]; } %}
   | MD               {% id %}

# Multiplication and division
MD -> MD _ "*" _ E   {% function(d) {return d[0]*d[4]; } %}
   | MD _ "/" _ E    {% function(d) {return d[0]/d[4]; } %}
   | E                {% id %}

# Exponentiation
E -> F _ "^" _ E     {% function(d) {return Math.pow(d[0], d[4]); } %}
  | F                 {% id %}
  | "-" E             {% function(d) {return -d[1]; } %}

# Parentheses and integers
F -> "(" _ AS _ ")"  {% function(d) {return d[2]; } %}
  | int              {% id %}

int -> [0-9]:+       {% function(d) {return parseInt(d[0].join("")); } %}

# Whitespace
_ -> [\s]:*          {% function(d) {return null; } %}

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about Nearley (mapped to pl/nearley). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Nearley/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Near-Brainfuck Neat →