• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
        • Io
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Std/io
        • Oslib
        • Bridge
          • Json-encoding
          • Security
          • Command
          • In-main-thread
          • Message
          • Start
          • Bindings
          • Stop
          • Try-in-main-thread
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
      • Bridge
        • Json-encoding
        • Security
        • Command
        • In-main-thread
        • Message
        • Start
        • Bindings
        • Stop
        • Try-in-main-thread
      • Clex
      • Tshell
      • Unsound-eval
      • Hacker
      • ACL2s-interface
      • Startup-banner
      • Command-line
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Interfacing-tools

Bridge

Connects ACL2 and the outside world.

The ACL2 Bridge is a general mechanism for allowing other programming languages, which may be much better than Lisp for certain tasks like developing graphical user interfaces, to interact with ACL2. It extends ACL2 with a server that can accept connections from client programs and run commands on their behalf. The basic picture is:

 _____________                    _______________________
|             |                  |                       |
|   ACL2   [bridge]--------------|  client program       |
|             |      socket      |  java, c, perl, ...   |
|_____________|                  |_______________________|

On the ACL2 side, the bridge is a simple listen/accept style server that waits for new clients. When a client connects, it creates a new worker thread to handle the client's requests. The worker thread presents the client with a kind of read-eval-print loop.

The client then sends commands. Basically each command says what s-expression to evaluate, and also indicates how the reply should be encoded. For instance, you can tell the bridge to return raw s-expressions, or you can tell it to use json-encoding to make the output easy to parse in some other programming languages. Other options may be added in the future.

The worker thread executes the command. As it runs, it may send messages to the client. These messages contain output that has been printed to standard output, the return value or error conditions, and a ready indicator that says when the worker is ready for more input. The messages are tagged with types so that the client can tell what kind of output it's receiving.

Some things are missing. There's currently no support for Lisp functions that want to read from standard input after they've been invoked. For instance, there's not really any way to interact with break loops, ld, etc. There's also currently no direct way to send an interrupt. However, workers announce their name to the client when they say hello, so a client could presumably open another connection and interrupt that way. We haven't developed this much, yet.

Subtopics

Json-encoding
Simple encoder to convert ACL2 Objects into JSON Objects.
Security
Important warnings about network security and the ACL2 bridge.
Command
Commands that the client sends to the bridge.
In-main-thread
Special mechanism for making sure forms execute in the main thread.
Message
Messages that the bridge sends to the client program.
Start
Start an ACL2 Bridge server.
Bindings
ACL2 Bridge interfaces for other programming languages.
Stop
Stop any running ACL2 Bridge servers.
Try-in-main-thread
Alternative to in-main-thread that exits immediately if the main thread is already busy with something else.