Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.16 KB

sample.org

File metadata and controls

40 lines (30 loc) · 1.16 KB

Running ABS code within org documents

HOWTO

Press C-c C-c within the following code block. If abs-mode is setup correctly (i.e., if you can compile and run abs programs from within emacs), the program’s output should appear below the block.

{
    println("Hello " + name() + "!");
}
{
    foreach (name in names()) {
        println("Hello " + name + "!");
    }
}

Internals

The given code is prepended with module Org;, so it’s not necessary to define the module in an abs block. All parameters are converted into zero-argument functions of type String or Int, which are exported from the Org module, so if the code uses another module it can use import * from Org; to access parameters given to the block.

Missing

  • List and array arguments: these can probably be handled analogous to the existing C integration.
  • Return value: we probably need to print these within abs and parse the output in emacs, again analogous to what C does.