Git Product home page Git Product logo

language-qux's Introduction

language-qux

Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status Release

Qux is an experimental language developed from the ground up with the aim of supporting extended static checks at compile time. This package provides tools for working with it (parsing, compiling, pretty printing and type checking) within Haskell code.

If you're interested in actually compiling Qux files, see here for the binary.

Aims

Qux is designed as an imperative, functional programming language with extended static checks for program verification. The goal is to be able to write pre- and post-conditions as part of type and method contracts that will be verifiable by mathematical means (e.g., a SMT solver or theorem prover).

Inspiration for a language with extended static checks has come from David J. Pearce's language, Whiley. During my honours year I contributed a solution for verifying Whiley's method contracts using an external SMT solver (Z3). For those interested in reading this rather long report, see here.

Tasks for v1

The language is in it's very initial stages of development and thus has very little features! There are a few core tasks in mind that need to be achieved before v1 can come about:

  • Key language features (assignment, strings, packages and imports).
  • Compilation to LLVM.

Of course, there will be minor tasks to accompany this release, such as documentation on the language features. The above merely mark the core functionality required.

Tasks for v2

  • Pre- and post-conditions on methods (using the requires and ensures keywords).
  • Compilation and verification of method contracts.
  • An intermediary language that retains contract information.

language-qux's People

Contributors

hjwylde avatar

Stargazers

James Michael DuPont avatar Amaury Catelan avatar april avatar Juan Bono avatar Elliot Cameron avatar Stephen Diehl avatar Daniel Kahlenberg avatar

Watchers

James Cloos avatar  avatar  avatar

language-qux's Issues

Import declarations

Add in support for import declarations and referencing external qux files.

This will require adding in a name resolution step (#15).

Raise exception on invalid function declarations

One of the steps should raise exceptions when an invalid function declaration is encountered.

This could be when it has the external attribute and a body, multiple external attributes or no attributes and no body.

Remove CallExpr

The use of an extra CallExpr with an ApplicationExpr is quite confusing. I think I should remove CallExpr and change ApplicationExpr to allow qualified calls.

language-qux-0.1.1.2 does not compile

Citing from http://hydra.cryp.to/build/1140271/log/raw:

src/Language/Qux/Annotated/Parser.hs:100:53:
    Ambiguous occurrence ‘<|>’
    It could refer to either ‘Control.Applicative.<|>’,
                             imported from ‘Control.Applicative’ at src/Language/Qux/Annotated/Parser.hs:25:1-26
                             (and originally defined in ‘GHC.Base’)
                          or ‘Text.Parsec.<|>’,
                             imported from ‘Text.Parsec’ at src/Language/Qux/Annotated/Parser.hs:32:1-40
                             (and originally defined in ‘Text.Parsec.Prim’)

src/Language/Qux/Annotated/Parser.hs:103:59:
    Ambiguous occurrence ‘many’
    It could refer to either ‘Control.Applicative.many’,
                             imported from ‘Control.Applicative’ at src/Language/Qux/Annotated/Parser.hs:25:1-26
                             (and originally defined in ‘GHC.Base’)
                          or ‘Text.Parsec.many’,
                             imported from ‘Text.Parsec’ at src/Language/Qux/Annotated/Parser.hs:32:1-40
                             (and originally defined in ‘Text.Parsec.Prim’)

Test suite

Add in a test suite. It may be that I just have an integration test suite on the qux project rather than unit tests here.

Error reporting from type resolver

The TypeResolver fails if it comes across a call to a non-existent function. This should be reported with an actual exception (like how the Parser or TypeChecker work).

See here.

Change nils to units.

I think I prefer the Haskell syntax of () for a unit value and type, I'm considering converting nils to this.

Remove the external keyword

Remove the external keyword and just determine whether a declaration is a prototype by whether it contains a body or not.

External type declarations

Add in the ability to declare external types.

This may be premature given that I don't even have user defined types, but it is needed for getting lists to work in #11.

Strings

Add in a datatype for strings. Strings will be represented as a list of characters, i.e., [Char].

Name resolution

Add in a name resolution step between parsing and type resolution that fully qualifies all function references.

Index doc

Write an index doc that links to all the documentation available.

Error reporting from name resolver

The NameResolver fails when either:

  • an argument is passed to a local variable access or,
  • there is more than 1 exporter of a function.

These errors should be reported with an actual exception (like how the Parser or TypeChecker work).

Compile lists to LLVM IR

#5 added compilation to the LLVM IR but omitted lists - this needs to be added in.

  • Compile list type (qux_lang_list_List)
  • Compile new list function (qux_lang_list_new)
  • Compile list concat function (qux_lang_list_concat)
  • Compile list length function (qux_lang_list_len)
  • Compile list accessor functions (qux_lang_list_z_acc and qux_lang_list_l_acc for integer and list respectively)

Key language features

The following are considered key language features that need implementing:

  • Variable assignment (#9).
  • String type (#10).
  • Package declarations.
  • Import declarations (#8).

Generic types

Implement parametric polymorphism / generic types such that I can write useful library functions.

Cheatsheet doc

Write a cheatsheet that summarises Qux's language features.

Method contracts

Add support for method contracts (requires and ensures keywords). Method contracts are mathematical statements that can be verified by a verification tool (think SMT solver or theorem prover).

The syntax of method contracts is still to be decided. I'll probably take some inspiration from Whiley and Dafny.

Type checking empty lists fails

A top type will make it possible to type check empty lists. Currently an exception is thrown as it is not possible to infer what type the list should be.

HLint

Add in an HLint pre-hook and check for Travis.

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.