Git Product home page Git Product logo

dex-lang's Introduction

Dex Test status

Dex (named for "index") is a research language for typed, functional array processing. The goal of the project is to explore:

  • Type systems for array programming
  • Mathematical program transformations like differentiation and integration
  • User-directed compilation to parallel hardware
  • Interactive and incremental numerical programming and visualization

To learn more, check out our paper, our tutorial or these example programs:

Or for a more comprehensive look, there's

  • The InDex of all documents, libraries, and examples included in this repository.

๐Ÿšจ Dex is an experimental research project at an early stage of development. Expect monstrous bugs and razor-sharp edges!

๐Ÿค Contributions welcome! See our issue tracker for good first issues, or browse by thematic labels.

Dependencies

  • Install stack
  • Install LLVM 12
    • Ubuntu/Debian: apt-get install llvm-12-dev
    • macOS: brew install llvm@12
      • Make sure llvm@12 is on your PATH before building. Example: export PATH="$(brew --prefix llvm@12)/bin:$PATH"
  • Install clang 12 (may be installed together with llvm)
    • Ubuntu/Debian: apt-get install clang-12
    • macOS: installs with llvm
  • Install libpng (often included by default in *nix platforms)
    • Ubuntu/Debian: apt-get install libpng-dev
    • macOS: brew install libpng

Installing

To build and install a release version of Dex run make install.

The default installation directory is $HOME/.local/bin, so make sure to add that directory to $PATH after installing Dex. To install Dex somewhere else, set the PREFIX environment variable before running make install. For example, PREFIX=$HOME make install installs dex in $HOME/bin.

Building

  • Build Dex in development (unoptimized) mode: make
  • Run tests in development mode: make tests

It is convenient to set up a dex alias (e.g. in .bashrc) for running Dex in development mode:

# Linux:
alias dex="stack exec dex -- --lib-path lib"

# macOS:
alias dex="stack exec --stack-yaml=stack-macos.yaml dex -- --lib-path lib"

You might also want to consider other development build targets:

  • build-opt for local optimized builds,
  • build-dbg for local debug builds,
  • build-prof for local optimized builds with profiling enabled.

Those non-standard targets require different aliases. Please consult the documentation at the top of the makefile for detailed instructions.

Haskell Language Server

In order to use HLS with the Haskell code in this project:

  • Install ghcup
  • Run ghcup install hls
  • Create a file in the root dex directory called hie.yaml with the following contents:
cradle:
  stack:
    stackYaml: "./stack-macos.yaml"  # Or stack.yaml if not on MacOS

Unfortunately one cannot dynamically select the stack.yaml file to use based on the environment, and so one has to create an appropriate hie.yaml file manually. This will be ignored by git.

This should work out of the box with Emacs' lsp-haskell package.

Building with Nix

Nix is a functional package manager and build system.

To build with vanilla Nix:

$ nix-build

To build with flakes-enabled Nix:

$ nix build .#dex

The resulting dex binary should be in result/bin/dex.

For development purposes, you can use a Nix environment with

$ nix-shell
$ nix develop  # With flakes

and use make to use Stack to build Dex.

Running

  • Traditional REPL: dex repl
  • Execute script: dex script examples/pi.dx
  • Live-updated notebook display dex web examples/pi.dx (html) or dex watch examples/pi.dx (terminal).

License

BSD-3

This is an early-stage research project, not an official Google product.

dex-lang's People

Contributors

dougalm avatar apaszke avatar axch avatar duvenaud avatar danieldjohnson avatar oxinabox avatar dan-zheng avatar srush avatar normanrink avatar mattjj avatar chenzizhao avatar joaogui1 avatar emilyfertig avatar jyh1 avatar darrenjw avatar alexreinking avatar niklasschmitz avatar dhhz avatar tscholak avatar sharadmv avatar peterbecich avatar lancelet avatar perimosocordiae avatar athas avatar bchetioui avatar cyntsh avatar devmotion avatar harryaskham avatar mkiefel avatar zhangqiaorjc avatar

Watchers

Robert Bongart (MSc MSc MA) 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.