Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

⚪ Pearley is a *shiny* new implementation of the Earley parsing algorithm in Javascript.

License

NotificationsYou must be signed in to change notification settings

purag/pearley

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pearley is ashiny new implementation of the Earley parsing algorithm in Javascript.

Pearley can parse any context-free grammar, including left-recursive, right-recursive, and ambiguous grammars, and grammars containing epsilon rules (the null/empty rule).

This demo shows how Pearley can parse math expressions with the +, -, *, and / operators, parentheses, and numbers of arbitrary length.

To run it, you must includetokenizer.js from my ParserGen repo to tokenize the strings.

You can also click the link to see the demo on jsFiddle. Check the console for output. First line of output is the tokenized string, second line of output is the list of tokens parsed by Pearley, and the last line of output is the table of state sets.

This demo lets you parse a string containing balanced pairs of parentheses, meaningn open parentheses followed byn close parentheses.

i.e.

  • ((()))
  • ()
  • `` (it works on empty strings)
  • ((((((()))))))

About

⚪ Pearley is a *shiny* new implementation of the Earley parsing algorithm in Javascript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp