Git Product home page Git Product logo

clingo-mode's Introduction

clingo-mode

A major mode for editing Potassco Answer Set Programs files (.lp).

From the Potassco website:

Answer Set Programming (ASP) offers a simple and powerful modeling language to solve combinatorial problems. With our tools you can concentrate on an actual problem, rather than a smart way of implementing it.

Features

  • Syntax highlighting
  • Commenting functionality
  • Run clingo from emacs
  • Some smart indentation (inherited from parent prolog-mode)

Keybindings

  • C-c C-b Call clingo with the current buffer
  • C-c C-e Call clingo with the current buffer as encoding and some user provided instance
  • C-c C-r Call clingo with the currently selected region

The above will all prompt for clingo command-line options (e.g., -c n=3 -n 0, etc.).

  • C-c C-c Comment region
  • C-c C-u Uncomment region

Installation

Melpa

clingo-mode is available through the https://github.com/melpa/melpa repository. This is the recommended way to install.

You can either install clingo-mode by hand with:

M-x package-install [RET] clingo-mode [RET]

or place the following snippet into your Emacs init file:

(unless (package-installed-p 'clingo-mode)
  (package-refresh-contents)
  (package-install 'clingo-mode))

Manually

Download the clingo-mode.el file from this repository. Either put it into your emacs load path and call (require 'clingo-mode) in your init file or load it directly with (load "~/path/to/clingo-mode.el")

Afterwards opening an .lp file triggers clingo-mode or call M-x clingo-mode within an open asp file.

Further work

  • IMPORTANT clingo-run-region is currently unsafe. The region is sent to clingo as a string, so any quotes or escape characters will affect what reaches clingo.
  • Smart indentation based on nesting depth
  • Refactoring of predicates/variables (complete buffer and #program parts)
  • Color compilation output
  • Smart rearrangement of compilation output (predicates separated, table…)
  • yas-snippet for rules; constraints; soft constraints; generation?
  • sync as much as possible with vim-syntax-clingo
  • integrations with org-mode, company, etc.

Contributions

Contributions, via issues, ideas and pull requests, are very welcome!

License

Copyright (c) 2020 by Ivan Uemlianin
Copyright (c) 2017 by Henrik Jürges

Distributed under the GNU General Public License v3; see LICENSE or type C-h C-c to view it.

clingo-mode's People

Contributors

llaisdy avatar santifa avatar tgamblin avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.