Skip to content

contificate/lr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An interactive tool for experimenting with LR(1) grammars.

example usage

Important notes:

  • Currently this uses viz-js in order to display the automaton and parse tree. This library is an emscripten compilation of dot, which itself uses a lot of memory. As a result, for medium-sized grammars, viz.js may complain that web assembly's memory is exhausted and be unable to draw the automaton. In the future, I intend to replace this with dagre-d3, following something like this.
  • The internal workings of this project rely heavily on hashing for item sets. The current solution is rather crude because it hashes a string representation of the item set (as OCaml's built-in polymorphic hash - murmur3 - caused too many collisions). This is a hacky solution but since we're compiling OCaml bytecode to JavaScript, it's admissable (forgivable) under a kind of "when in Rome.." policy.

TODO:

  • Implement state merging on kernel items, enabling optional construction of LALR(1) automatons.
  • It'd be nice if resolved conflicts were retained upon editing of the grammar to avoid having to reset them all after any change.

About

An interactive tool for experimenting with LR(1) grammars

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published