MCPcopy
hub / github.com/Chevrotain/chevrotain

github.com/Chevrotain/chevrotain @v0.5.21 sqlite

repository ↗ · DeepWiki ↗ · release v0.5.21 ↗
2,536 symbols 5,073 edges 98 files 302 documented · 12%
README

npm version Build Status Coverage Status Dependency status devDependency Status

Chevrotain

Chevrotain is a Javascript parsing DSL for building high performance fault-tolerant recursive decent parsers.

Chevrotain is NOT a parser generator. It solves the same kind of problems as a parser generator, just without any code generation phase.

---> Try it online <---

Features

  1. Lexer Engine based on Regular Expression.

    • Supports Token location tracking.
    • Supports Token skipping (whitespace/comments/...).
    • Allows prioritising shorter matches (Keywords vs Identifiers).
    • No code generation The Lexer does not require any code generation phase.
  2. Parsing DSL for defining the grammar.

    • No code generation.
    • The DSL is just Javascript, not an external language.
    • The Parsing flow is easily debuggable.
    • Short feedback loops.
    • Allows great flexibility for inserting custom Parser actions.
    • Error Reporting with full location information.
    • Strong Error Recovery/Fault-Tolerance capabilities based on Antlr3's algorithms.
    • Automatic lookahead calculation for LL(1) grammars.
    • Supports Custom lookahead logic for LL(k) grammars.
    • Backtracking support.
  3. High performance - (see on JSPerf).

  4. Grammar Reflection/Introspection.

    • The Grammar's structure is known and exposed at runtime.
    • Can be used to implement advanced features such as dynamically generated syntax diagrams or Syntactic error recovery.
  5. Well tested with ~100% code coverage, Unit & Integration tests

Installation

  • npm: npm install chevrotain
  • Bower bower install chevrotain
  • or download directly from github releases

Getting Started

Online tutorial * Step #1 - Building a Lexer: online version / written version. * Step #2 - Building a Parser: online version / written version. * Step #3 - Adding actions to the Parser: online version / written version. * Step #4 - Fault tolerance and Error recovery: online version / written version.

Examples Folder

Documentation

Dependencies

None.

Compatibility

Chevrotain should run on any modern Javascript ES5.1 runtime. * The CI build runs the tests under: * Node.js (0.12 / 4 / 5). * latest stable Chrome. * latest stable Firefox. * Additionally local testing is done on latest versions of Chrome/Firefox/IE. * Uses UMD to work with common module loaders (browser global / amd / commonjs).

Extension points exported contracts — how you extend this code

IProductionWithOccurrence (Interface)
(no doc) [8 implementers]
release/chevrotain.d.ts
IProductionWithOccurrence (Interface)
(no doc) [8 implementers]
src/parse/grammar/gast_public.ts
IRange (Interface)
(no doc) [2 implementers]
src/text/range.ts
IRunnable (Interface)
Partial interface for Mocha's `Runnable` class.
libs/mocha.d.ts
TemplateSettings (Interface)
* By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the fol
examples/typescript_ecma5/libs/lodash.d.ts
RetType (Interface)
(no doc)
test/full_flow/error_recovery/switch_case/switchcase_recovery_parser.ts
IAnalyzeResult (Interface)
(no doc)
src/scan/lexer.ts
ChaiStatic (Interface)
(no doc)
libs/chai.d.ts

Core symbols most depended-on inside this repo

equal
called by 710
examples/typescript_ecma5/libs/chai.d.ts
push
called by 239
examples/typescript_ecma5/libs/lodash.d.ts
CONSUME
called by 198
examples/typescript_ecma5/src/ecmascript5_parser.ts
SUBRULE
called by 173
src/parse/parser_public.ts
concat
called by 130
examples/typescript_ecma5/libs/lodash.d.ts
CONSUME1
called by 113
src/parse/parser_public.ts
PT
called by 113
examples/typescript_ecma5/src/parse_tree.ts
RULE
called by 99
examples/typescript_ecma5/src/ecmascript5_parser.ts

Shape

Class 1,090
Method 733
Function 585
Interface 122
Enum 6

Languages

TypeScript100%

Modules by API surface

examples/typescript_ecma5/src/ecmascript5_tokens.ts540 symbols
examples/typescript_ecma5/libs/lodash.d.ts264 symbols
release/chevrotain.min.js174 symbols
release/chevrotain.js173 symbols
src/parse/parser_public.ts119 symbols
test/parse/recognizer_lookahead_spec.ts95 symbols
libs/chai.d.ts92 symbols
examples/typescript_ecma5/libs/chai.d.ts92 symbols
test/full_flow/error_recovery/sql_statements/sql_recovery_tokens.ts70 symbols
test/scan/lexer_spec.ts60 symbols
test/parse/recognizer_spec.ts58 symbols
src/parse/grammar/interpreter.ts52 symbols

Dependencies from manifests, versioned

chai3.5.0 · 1×
chevrotain* · 1×
coveralls2.11.6 · 1×
extend2.0.1 · 1×
gitty3.3.3 · 1×
grunt0.4.5 · 1×
grunt-cli0.1.13 · 1×
grunt-contrib-clean1.0.0 · 1×
grunt-contrib-compress1.0.0 · 1×
grunt-contrib-concat1.0.0 · 1×
grunt-contrib-uglify1.0.0 · 1×
grunt-coveralls1.0.0 · 1×

For agents

$ claude mcp add chevrotain \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact