Coder Social home page Coder Social logo

pasp-mode's Introduction

License GPL 3 MELPA

pasp-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

Keybindings

Not so many at the moment:

  • C-c C-b Call clingo with the current buffer
  • C-c C-x Call clingo with the current buffer as encoding and some user provided instance

Installation

Melpa

The Potassco ASP mode is available through the MELPA repository. This is the recommended way to install the pasp-mode.

You can either install pasp-mode by hand with: M-x package-install [RET] pasp-mode [RET]

or place the following snippet into your Emacs init file:

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

Manually

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

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

Todo

  • Smart indentation based on nesting deepth
  • Refactoring of predicates/variables (complete buffer and #program parts)
  • Color compilation output
  • Smart rearrange of compilation output (predicates separated, table...)
  • yas-snippet for rules; constraints; soft constraints; generation?

Contributions

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

License

Copyright (c) 2017 by Henrik Jürges

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

pasp-mode's People

Contributors

santifa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pasp-mode's Issues

atoms and variables not highlighted when containing an underscore

When using underscores in atoms or variables, there is no highlighting.

I suspect it is because of the presence of the underscore in the pasp--constructs regexp. I suppose that you added the underscore in this regexp in order to take into account anonymous variables. The problem is that this regexp is matched before the regexp for atoms and variables.

One possible workaround (which I use) is:

  • remove the underscore from the pasp--constructs regexp
  • modify pasp--variable as follows:
(defconst pasp--variable
  '("_*\\([[:upper:]][[:word:]_']*\\)*" . font-lock-variable-name-face)
  "ASP variable.")

With this modification, anonymous variables are highlighted just like other variables.

A side question is: I don't understand what is the intent of the pasp--variable2. What ASP construct do you catch with it ?

not highlight

Hi there,

first of all thanks for implementing this asp-mode.
just a minor thing. I was using the predicate "noteValue" in one of my programs and the not was red highlighted.

I have given a space in the pasp-mode.el in the lines 150 and 162 like so:
'(("not " . font-lock-negation-char-face)

So far now I can highlight the default negation when used as it and not as part of any predicate, atom, etc.
I'm not expert on this and you might know a lot better than me about how this emacs file works but I hope that doesn't change any other feature.

Regards
Flavio
any comment, let me know at [email protected]

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.