Code Monkey home page Code Monkey logo

piq's Introduction

piq

Tests

logo

piq (/piːk/) is a fast, minimal, statically typed, easily bootstrappable, compiled programming language. It is written piq, with a lowercase p, because this has a nice symmetry. If it doesn't look symmetrical to you, consider changing your font.

Fast

The language is fast. It's close to the metal, there's no indirection.

The compiler is fast. The single-threaded performance is currently at about 170_000 sloc/s on my laptop.1

The compiler itself is fast to compile.2

Minimal

The piq syntax is a direct representation of the AST, where all compound constructs have an introducer keyword, and are parenthesized. For example (if cond a b) for ternary expressions, and (fn () 3) for lambdas.3 This is easy to parse, for humans and computers, without backtracking.

Statically typed

All piq types are known at compile time. It has full type inference, so if you have enough type constraints in your compilation unit such that there is only one solution, the compiler will be satisfied.

Compiled

It currently has working LLVM codegen, with JIT'd code running in our test suites, but the plan is to support libgccjit and others.

Easily bootstrappable

The piq stage0 compiler is written in C99.4 This is currently the only compiler.

Usage

Please see the (incomplete) usage guide.


Status

Passes

  • Tokenizer
  • Parser
  • Name Resolution
  • Typecheck/inference
  • Codegen (llvm)

Language features

  • Function declarations
  • Let bindings
  • Function calls
  • Builtin types
  • Type parameters
  • If statements
  • Pattern matching
  • Custom datatypes
  • Mutation
  • References
  • C FFI
  • Generics

Stdlib

  • Syscall wrappers
  • Malloc/free replacements

Misc

  • A name
  • Compilation multithreading
  • A compiler perf tracking website5
  • Package management
  • A good logo

Footnotes

  1. This is on laptop with an AMD Ryzen 5 5625U. The compiler performance can be greatly improved by multi-threading, and by a tonne of optimizations I haven't yet had time to implement.

  2. Takes about 3.4 seconds on my laptop. This can be improved, see 4.

  3. The current tuple syntax doesn't follow this rule, but this is a bug I will fix soon.

  4. There's a smidgen of C++, written because LLVM's C interface is missing a feature I want. This is trivial to get rid of, but requires a malloc somewhere to do so, so I haven't brought myself to 🔥 do it yet. 2

  5. There was one here but I need to update it to use a benchmark-specific machine with a fixed clock speed.

piq's People

Contributors

414owen avatar

Stargazers

 avatar Stelios Georgiou avatar Boris Kayi avatar cpunk avatar Syuparn avatar  avatar Marc Jakobi avatar  avatar

Watchers

David Phillips avatar  avatar  avatar

Forkers

nasingfaund

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.