1
0
Fork
You've already forked interactive-lang-tools
0
Emacs tools for interactive programming languages.
  • Emacs Lisp 90.8%
  • Common Lisp 6.6%
  • Python 2.2%
  • JavaScript 0.4%
Find a file
2025年11月06日 12:49:34 +01:00
archive Publish 0.6 2022年09月28日 12:01:40 -03:00
backends Introduce socket connections. TODO. 2023年05月02日 13:09:53 -03:00
docs README: semantic model 2022年09月03日 22:59:03 -03:00
tests Things ... 2022年08月07日 22:13:06 -03:00
.gitignore git ignore Emacs compiled files 2022年08月12日 09:07:17 -03:00
.gitmodules Update .gitmodules 2025年11月06日 12:49:34 +01:00
ilt-backend-tests.el More backend tests work 2023年04月09日 11:11:24 -03:00
ilt-doc.el Emacs archive 2022年09月23日 18:31:03 -03:00
ilt-inspector.el Improvements 2023年04月08日 10:39:55 -03:00
ilt-repl.el Doesn't work yet .. 2023年04月08日 10:59:23 -03:00
ilt-system-browser.el ilt-system-browser 2023年04月09日 20:11:43 -03:00
ilt.el Introduce socket connections. TODO. 2023年05月02日 13:09:53 -03:00
inline-message.el inline-message: requires 2023年04月04日 17:08:41 -03:00
README.md .. 2023年04月06日 22:25:40 -03:00
schema.el Make schema library loadable 2023年04月08日 13:11:32 -03:00
TODO TODO 2023年04月12日 11:04:53 -03:00

Interactive Language Tools

This is a set of tools in Emacs for programming languages that allow interactive programming.

Motivation

Many languages, specially new and small languages, implement some support for interactive development, but don't come with the tools for realizing that. Examples of that are JSCL (Common Lisp in the web browser), LIPS (a Scheme for the web), .. and many more.

This is my attempt at trying to provide tools for such languages as cheaply as possible.

Why not Language Server Protocol?

Language Server Protocol is very good, but it doesn't support interactive development. Things like evaluation, REPL, incremental compilation, are not part of the protocol. Also, LSP is very complex to implement. ILT is a minor-mode and can work as a complement of LSP.

Why not SLIME/SWANK?

SLIME/SWANK are very powerful tools for interactive development in Common Lisp. They are quite specialized towards Lisp, and Lisp like languages. For instance, the protocol is based on S-Expressions.

ILT is targeted at any kind of language, and implements its protocol via JSONRPC. JSONRPC is probably easier to implement in most languages, as most languages come with very good support of JSON.

Also, ILT tries to be as easy as possible to implement on the targeted programming language side. And uses the target language introspection capabilities to build a semantic model of the elements of the language, so that it can be leveraged by the tools.

Install

For easy installation, you can add as an Emacs package archive:

(add-to-list 'package-archives '("interactive-lang-tools" . "https://codeberg.org/mmontone/interactive-lang-tools/raw/branch/master/archive/"))

Then install the packages from M-x package-list-packages.

Note that you will need backend files for your programming languages too. You have to download them from this repository.

Load ilt.el in Emacs, and the corresponding backend module from backend directory.

Then enable ilt-mode for your language using hooks:

(add-hook 'lisp-mode-hook 'ilt-mode)

or call ilt-mode interactively in your source buffer. You'll be asked for the backend to use, and the connection options.

Tools

How it works

ILT connects and communicates with the target programming language via a JSONRPC protocol. Sends messages for evaluation, compilation, fetching properties of modules, definitions, etc.

Protocol

  • evaluate (source: string, module-name: string, ctxid: string)

Evaluates source under module-name and context with id ctxid.

Returns:

{
 "type": "object",
 "properties": {
 "id" : {},
	 "repr" : { "type" : "string"},
	 "type" : { "type" : "string"},
	 "kind" : { "type" : "string"}
 },
 "required": ["repr", "type", "kind"]
}
  • id : When present, a unique identifier referencing the resulting object. That id can be used later by other protocol methods (like get_definition_properties) to get information for the referenced objects. Can be anything, decided by the backend. A string, or a more complex object.
  • repr : The printed representation of the resulting object.
  • type : The type of the resulting object, in the targeted programming language.
  • kind : The ILT "type" of the result. One of "boolean", "string", "symbol", "number", "character", "map", "array", "function", "object", "class", "list".

Semantic model

semanticmodel

@startuml
class Definition {
 id : object;
 name: string;
 repr: string;
 type: string;
 module: string;
 doc: string;
}
class Module {
 
}
class Function {
 args: Array;
}
class Variable {
}
Module -u-|> Definition
Function -u-|> Definition
Variable -u-|> Definition
Class -u-|> Definition
Module "members *" -> Definition
enum Kind {
 string
 number
 boolean
 object
 class
 map
 array
}
class Reference {
 id: object;
 repr: string;
 type: string;
 module: string;
}
Definition "kind" -> Kind
Reference "kind" -> Kind
@enduml

Current backends

Commands

  • ilt-connect (backend) - Start an ILT connection with BACKEND language, and bind it to the current buffer.
  • ilt-eval-last-expr - Evaluate last expression in buffer.
  • ilt-compile-last-expr - Compile last expression in buffer.

Connection sessions

Connection sessions are handled via Sesman.