An ACT for Emacs

18 July 2024

Motivation

ACT is the programming language to describe asynchronous circuits and it might be difficult to make some elements of the language apart without some syntax highlighting. You can see on the following brief snippet how ACT looks like.

  
import "globals.act";

export defproc nand_gate(globals g; bool a, b, c)
{
    prs<g.Vdd, g.GND>
    {
        (a & b) -> c-
        ~a | ~b -> c+
    }
}

globals g;
bool a, b, c;
nand_gate dut(g, a, b, c);
  

And, albeit some elements of the language are defined externally I made my life easier writing a package for the Emacs text editor. If you, like me, is using that editor to write some ACT (though I highly doubt that you are) you can use my package that’s available on MELPA as act-mode.

If it’s on MELPA you can just M-x package-install act-mode. You can also associate all .act files with the mode instead of loading it every time you open an act file.

  
(use-package act-mode
  :ensure
  :mode
  ("\\.act\\'" . act-mode))
  

How does it look like?

You can see how a snippet of code look like in the following image.

act-mode example