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/nearleyExtensions 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.| Extension | Source | Strength | SWH |
|---|---|---|---|
.ne | linguist | primary | 42.5K files |
.nearley | linguist | secondary | 100 files |
Related languages
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
# 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.)