Giter Club home page Giter Club logo

forvie's Introduction

Forvie

Forvie is an integrated collection of utilities for implementing small programming languages, itself implemented in Haskell. The driving principle behind Forvie is the idea that specifications of programming languages should be first-class entities within the meta-language, Haskell. Given this, runtime manipulation of language specifications is possible, and multiple backends can be generated. For example, compiler frontends and syntax highlighting code for editors can be generated from the same specification.

Current Features

At the moment, Forvie has the following features:

  • A Haskell type of specifications of the lexical structure of a programming language. Lexical structure is specified by means of a collection of regular expressions with attached tokens. The regular expressions language is Unicode-aware and includes non-standard features such as complementation (“all strings that do not match this regular expression“) and conjunction (“all strings that match both regular expressions”).

  • Lexer generators, which take a lexical specification and produce code that splits text into lexemes according to the specification. All the lexer generators currently work by translating the specification to a DFA.

    The lexer generators that currently exist are:

    • A dynamic lexer generator that takes a lexical specification during the runtime of a Haskell program and returns a function that performs lexing.

    • A static lexer generator that uses Template Haskell to generate Haskell code at compile time that does the same job as the dynamic lexer, but can benefit from compiler optimisations.

    • An Emacs Lisp generator that outputs Elisp code. This is used to generate Emacs modes with syntax highlighting based on the lexical structure of a programming language.

    • An HTML syntax highlighter that produces HTML syntax-highlighted code, based on the lexical structure.

  • A post-processor for Haskell-style whitespace-significant layout. This allows automatic insertion of braces (‘{’ and ‘}’) and semicolons (’;’) based on the indentation structure of the input. The Forvie implementation does not implement all of the Haskell-style layout rules, since this requires tight bi-directional communication between the parser and the layout processor.

Future Plans

Future plans for Forvie revolve around two poles:

  • Refinement of the current features. This includes:
    • Addition of anchors to the regular expression language to match line endings and beginings.
    • More support for generation of syntax-highlighting code
  • Extending to cover more features of language specification
    • In particular, the context-free structure of programming languages.
    • The name-binding and scoping rules of programming languages.

Also, optimisation opportunities arising from the declaration specification of language features are also being explored.

forvie's People

Contributors

bobatkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.