GithubHelp home page GithubHelp logo

grune's People

Contributors

fifty-nine avatar

Stargazers

 avatar

Watchers

 avatar  avatar

grune's Issues

Clean up ownership model

Currently, everything passed to a grammar needs to stay valid for the lifetime of the grammar. We should rework things so that the grammar owns everything.

Add EDSL for building grammars

Once we fix #9, it will probably be a little more unwieldy to instantiate a grammar. We should implement an EDSL for creating grammars, c.f. the builder pattern.

Investigate refactoring grune::production

grune::production takes a sequence_list as its right-hand side. It might make things simpler if we only allowed a production to map from a sequence to a sequence, but allowed multiple productions with the same left-hand side.

Add regular expression terminals.

We need a way to have terminals that match a regular expression. We could probably represent them using the existing grammar model nested under a new terminal subclass, or we could use a purpose-built regular expression library that meets the requirements of both parsing and generating sentences.

Add parser library framework

We should add a new library for parsing the grammars modeled by the library. The library should include at least one basic parser. The library should probably support both runtime parsing and code generation, though not necessarily with the same parsers. This would probably make sense to put in a separate github project.

Add additional pretty printers

Currently the only way to print a grammar is by calling to_string, which returns a simple EBNF-like syntax. We should add additional pretty print formats, especially ones that are easily machine-readable, e.g. YAML, JSON and/or XML.

Add additional checking

We should add exceptions for when the user tries to create an invalid grammar. For instance, it's possible to create a production with only terminals on the left.

Implement sentence generation

We should add an interface to generate a sentence from a grammar. Since the algorithm for generating every sentence from a grammar is exhaustive, I think this might make sense as a forward iterator.

The interface could look something like:

for (auto sentence : grammar.sentences()) 
{
  cout << to_string(sentence);
}

Note that generating even a single sentence from a Type-0 grammar is potentially unbounded, so maybe we should provide a different interface for letting the user acknowledge that, but still try to generate sentences.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.