# Graphical code editor and profiler?

**URL:** <https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659>\
**Category:** General\
**Created:** [December 9, 2024, 7:06pm UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659 "2024-12-09T19:06:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayureshkathe](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mayureshkathe/32/6895_2.png) [@mayureshkathe](https://swi-prolog.discourse.group/u/mayureshkathe)\
**Post date:** [December 9, 2024, 7:06pm UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/1 "2024-12-09T19:06:28Z")

</div>

I have noticed places on the web where posts mentioned the existence of a graphical debugger being distributed with the SWI-Prolog package.

I have also noticed posts mentioning the absence of a graphical code editor.

And I have noticed the absence of a profiler (e.g. [GitHub - plasma-umass/coz: Coz: Causal Profiling](https://github.com/plasma-umass/coz)).

Also, is it true that XPCE is being deprecated?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 9, 2024, 7:56pm UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/2 "2024-12-09T19:56:15Z")

</div>

xpce is deprecated as a means to build new graphical applications in SWI-Prolog. For now, it is not going to be discontinued though as it is used for most of the development tools. These tools include PceEmacs, a GNU-Emacs clone written in Prolog+xpce. Most of its functionality is now part of the sweep package for GNU-Emacs. The graphical front-end for the profiler is also in xpce (not sure what “coz” does), as well as a thread monitor, cross referencing tool, etc.

xpce is mainly old, and is not likely to be updated to deal with modern look and feel, scaling, alpha channel, rotation, etc. Other than that, it will stay alive for quite a while, so if it suits your needs, use it.

These days I mostly write UIs as web services. Notably the [https://htmx.org/](https://htmx.org/) framework fits nicely with SWI-Prolog’s web infrastructure.

---

<div class="post-metadata">

**Author:** ![mayureshkathe](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mayureshkathe/32/6895_2.png) [@mayureshkathe](https://swi-prolog.discourse.group/u/mayureshkathe)\
**Post date:** [December 10, 2024, 10:16am UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/3 "2024-12-10T10:16:35Z")

</div>

I could not figure out how to invoke PceEmacs.

I am running Ubuntu and have installed the entire SWI-Prolog package.  
If there is something more to install, would you please share the details?

Saw a few screenshots, and XPCE does not look all that bad.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 10, 2024, 10:28am UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/4 "2024-12-10T10:28:42Z")

</div>

You need to install `swi-prolog-x`, i.e.

```
 sudo apt-get install swi-prolog-x

```

Debian likes small packages 🙂 This makes sense as server installations typically do not want the GUI and on a server it would pull in all the X11 stuff.

---

<div class="post-metadata">

**Author:** ![mayureshkathe](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mayureshkathe/32/6895_2.png) [@mayureshkathe](https://swi-prolog.discourse.group/u/mayureshkathe)\
**Post date:** [December 10, 2024, 10:35am UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/5 "2024-12-10T10:35:27Z")

</div>

Thanks for the prompt response. I already have installed “swi-prolog-x”.  
Is there any binary I need to execute at the command-line?

I executed “swipl”, but couldn’t figure how to proceed, then ran “apropos pceemacs”, still could not follow the instructions.

I searched for PceEmacs as well as pceemacs on the Ubuntu system, found nothing.

---

<div class="post-metadata">

**Author:** ![mayureshkathe](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mayureshkathe/32/6895_2.png) [@mayureshkathe](https://swi-prolog.discourse.group/u/mayureshkathe)\
**Post date:** [December 10, 2024, 10:41am UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/6 "2024-12-10T10:41:58Z")

</div>

No more issues. Found a document explaining how to start-up PceEmacs.

Jan, thanks for the support. 😊

BTW, XPCE really does not “look” all that bad, certainly not a good citizen as far as LnF integration with Ubuntu goes, but seems quite functional.

---

<div class="post-metadata">

**Author:** ![mayureshkathe](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mayureshkathe/32/6895_2.png) [@mayureshkathe](https://swi-prolog.discourse.group/u/mayureshkathe)\
**Post date:** [December 10, 2024, 12:44pm UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/7 "2024-12-10T12:44:39Z")

</div>

I played with the PceEmacs editor as well as a bunch of the included tools.  
It was interesting.  
Other than the fact that the widgets have an archaic look and feel, there is not much to crib/complain about.

I have used a lot of GUIs, but the important point to consider is “design is not so much about how it looks, as it is about how it works”.

Developers engaged with Prolog, and especially those building graphical applications using SWI-Prolog are already considered outliers.  
As an example, take the case of [Squeak](https://squeak.org/) or even [Pharo](https://pharo.org/), their applications “do not” confirm to the native look and feel, at all.

It would be worthwhile to consider developing a full IDE using the components that exist as separate tools.  
Considering the design of such an integrated development system, I would wholeheartedly vouch for [Aza Raskin](https://azaza.org/), my mentor’s son.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 10, 2024, 2:02pm UTC](https://swi-prolog.discourse.group/t/graphical-code-editor-and-profiler/8659/8 "2024-12-10T14:02:46Z")

</div>

> [@mayureshkathe](#):
>
> It would be worthwhile to consider developing a full IDE using the components that exist as separate tools.  
> Considering the design of such an integrated development system, I would wholeheartedly vouch for [Aza Raskin](https://azaza.org/), my mentor’s son.

I’m open to any initiative to make (SWI-)Prolog more accessible. There are a lot of possible routes and I never really made up my mind. The good news is that developments such as PDT (Eclipse plugin), SWISH, VsCode plugin and [sweep](https://eshelyaron.com/sweep.html) have turned a large part the IDE infrastructure into a number of pure Prolog libraries, separated from the GUI code.

Over the years I’ve built up a set of tools in xpce+Prolog mostly to suit my own needs. Many people have contributed to that with small patches, but notably with complaints and suggestions. The tools are not “integrated”, in part by design as this allows them to be used together with other tools. As a consequence you can use the graphical debugger while Prolog runs embedded in emacs/vscode/eclipse/…

Notably the editor is a difficult choice. Programmers want one editor for all their work. Supporting Prolog is hard for most environments due to the somewhat awkward syntax and notably due to the lack of keywords and the “program is data” feature. Both make it hard to classify tokens while a language with these properties make this classification more important. Proper highlighting requires fairly detailed program analysis and integrating that into an external editor is hard. sweep is the only successful integration, achieved by embedding Prolog into GNU-Emacs. _Language Server Protocol_ (LSP) seems attractive, but does as yet not provide a full workable alternative.
