forked from M-Labs/nac3
1
0
Fork 0
New ARTIQ compiler, third iteration
Go to file
David Mak 581b2f7bb2 [standalone] Add demo for global variables 2024-10-04 13:24:30 +08:00
nac3artiq [core] Add generator to SymbolResolver::get_symbol_value 2024-10-04 13:20:29 +08:00
nac3ast meta: Update dependencies 2024-07-04 15:32:18 +08:00
nac3core [core] Add support for global statements 2024-10-04 13:24:27 +08:00
nac3ld [meta] Reorganize order of use declarations 2024-10-04 12:52:01 +08:00
nac3parser [meta] Reorganize order of use declarations 2024-10-04 12:52:01 +08:00
nac3standalone [standalone] Add demo for global variables 2024-10-04 13:24:30 +08:00
nix msys2: get python via numpy dependencies 2024-09-30 14:27:30 +08:00
runkernel meta: Restrict number of allowed lints 2024-06-12 16:10:57 +08:00
.clang-format add .clang-format 2024-08-27 22:55:22 +08:00
.clippy.toml meta: Restrict number of allowed lints 2024-06-12 16:10:57 +08:00
.gitignore standalone/demo: separate linalg functions from main workspace 2024-08-05 11:44:54 +08:00
.pre-commit-config.yaml [meta] Update pre-commit config 2024-09-09 14:24:38 +08:00
Cargo.lock [meta] Update Cargo dependencies 2024-10-04 12:52:01 +08:00
Cargo.toml standalone: move linalg functions to demo 2024-07-31 13:23:05 +08:00
README.md meta: Update README to include info regarding pre-commit hooks 2024-06-12 16:10:57 +08:00
flake.lock flake: update nixpkgs 2024-09-30 14:22:40 +08:00
flake.nix clean up and fix 32-bit demos 2024-08-05 19:04:25 +08:00
nac3.svg add icon 2022-04-18 15:07:53 +08:00
rustfmt.toml move rustfmt.toml upper 2022-01-09 11:31:06 +08:00

README.md

icon

NAC3

NAC3 is a major, backward-incompatible rewrite of the compiler for the ARTIQ physics experiment control and data acquisition system. It features greatly improved compilation speeds, a much better type system, and more predictable and transparent operation.

NAC3 has a modular design and its applicability reaches beyond ARTIQ. The nac3core module does not contain anything specific to ARTIQ, and can be used in any project that requires compiling Python to machine code.

WARNING: NAC3 is currently experimental software and several important features are not implemented yet.

Packaging

NAC3 is packaged using the Nix Flakes system. Install Nix 2.8+ and enable flakes by adding experimental-features = nix-command flakes to nix.conf (e.g. ~/.config/nix/nix.conf).

Try NAC3

Linux

After setting up Nix as above, use nix shell git+https://github.com/m-labs/artiq.git?ref=nac3 to get a shell with the NAC3 version of ARTIQ. See the examples directory in ARTIQ (nac3 Git branch) for some samples of NAC3 kernel code.

Windows

Install MSYS2, and open "MSYS2 CLANG64". Edit /etc/pacman.conf to add:

[artiq]
SigLevel = Optional TrustAll
Server = https://msys2.m-labs.hk/artiq-nac3

Then run the following commands:

pacman -Syu
pacman -S mingw-w64-clang-x86_64-artiq

For developers

This repository contains:

  • nac3ast: Python abstract syntax tree definition (based on RustPython).
  • nac3parser: Python parser (based on RustPython).
  • nac3core: Core compiler library, containing type-checking and code generation.
  • nac3standalone: Standalone compiler tool (core language only).
  • nac3ld: Minimalist RISC-V and ARM linker.
  • nac3artiq: Integration with ARTIQ and implementation of ARTIQ-specific extensions to the core language.
  • runkernel: Simple program that runs compiled ARTIQ kernels on the host and displays RTIO operations. Useful for testing without hardware.

Use nix develop in this repository to enter a development shell. If you are using a different shell than bash you can use e.g. nix develop --command fish.

Build NAC3 with cargo build --release. See the demonstrations in nac3artiq and nac3standalone.

Pre-Commit Hooks

You are strongly recommended to use the provided pre-commit hooks to automatically reformat files and check for non-optimal Rust practices using Clippy. Run pre-commit install to install the hook and pre-commit will automatically run cargo fmt and cargo clippy for you.

Several things to note:

  • If cargo fmt or cargo clippy returns an error, the pre-commit hook will fail. You should fix all errors before trying to commit again.
  • If cargo fmt reformats some files, the pre-commit hook will also fail. You should review the changes and, if satisfied, try to commit again.