PascalFC & Visual Studio Code — a quick (and dirty) basic setup

So… Pascal-FC. If you don’t know what Pascal-FC is (and if you don’t, how did you end up here?), Pascal-FC (as its main page says) is a programming language created in the 1980s, aimed at supporting the teaching of concurrent programming. It supports a wide range of concurrency primitives including semaphores, monitors with condition variables, synchronous message passing using channels, remote invocation, protected resources and requeue.

Back in the days, vi or emacs were the programming text editors for excellence. Today we have plenty of options, but none of them have support for Pascal-FC. In this article I present some quick (and dirty, I have to say) basic setup for compiling and executing Pascal-FC with VSCode.

Fig 1. Compile on save + Launch example

Prerequisites

Extensions

Let’s start!

Compile on save

First, we’re going to configure some commands to compile when saving. To do so, add to your settings.json file the following commands:

"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.pfc$",
"cmd": "rm \"${fileDirname}/${fileBasenameNoExt}.lis\""
},
{
"match": "\\.pfc$",
"cmd": "rm \"${fileDirname}/${fileBasenameNoExt}\""
},
{
"match": "\\.pfc$",
"cmd": "pfccomp \"${fileDirname}/${fileBasenameNoExt}.pfc\" \"${fileDirname}/${fileBasenameNoExt}.lis\" \"${fileDirname}/${fileBasenameNoExt}\""
},
],
},

Done! Now, if you save a .pfc file, VSCode will generate LIS and binary compilation files (if success, otherwise only the LIS file will be generated).

Run with Launch

Now, we’re going to create a VSCode task and then execute it with the VSCode Launch feature.

1. Create the task: add to your tasks.json file the following task:

"tasks": [
...
{
"label": "Run PascalFC",
"type": "shell",
"command": "pint \"${fileDirname}/${fileBasenameNoExtension}\" \"${fileDirname}/${fileBasenameNoExtension}.pmd\"",
"presentation": {
"reveal": "always",
"panel": "new"
}
},
...
]

2. Create the Launch configuration: add to your launch.json file the following launch configuration:

{
"version": "0.2.0",
"configurations": [
...
{
"type": "ILauncher",
"request": "launch",
"name": "Run PascalFC",
"preLaunchTask": "Run PascalFC"
},
...
]
}

And that’s it! We should have now a VSCode with some basic funcionality of Pascal-FC. There’s some TODO work like formatting and syntax highlighting, so I’ll be updating this post if I found a good way of covering those topics. Stay tuned and thanks for reading!

Curious since I was a child, Software Engineering as my profession now. Working as Technical Leader in Rappi, Colombia. Welcome to my post!