Skip to content

Instantly share code, notes, and snippets.

@nixin72
Last active November 5, 2020 18:00
Show Gist options
  • Save nixin72/1019ba4cf37123e5e1ae3d598886bc5b to your computer and use it in GitHub Desktop.
Save nixin72/1019ba4cf37123e5e1ae3d598886bc5b to your computer and use it in GitHub Desktop.
Quick guide on getting things set up for COMP-348

Guide to software for COMP-348

NOTE: As a heads up, I will not be adding to this gist anymore. I've written more detailed instructions for each language on the COMP-348 website, and you can find a lot more help on that website than what's available here.

Prolog

For Prolog, I highly recommend just using an online editor.

This editor allows you to do everything you would do by downloading a local Prolog environment, while giving you a likely more comfortable user interface than the terminal. It's very easy to use, when you open it up, you'll see a page that looks like this: swish Simply click on the Program button, and you'll be brought to a small text editor. On the left hand side is where you put all your facts and rules. For example, copy-paste this into the left-hand side:

person(john, albert).
person(tina, albert).
person(john, beth).
person(tina, beth).
person(john, mark).
person(sheryl, mark).
person(john, david).
person(sheryl, david).
person(beth, meredith).
person(jason, meredith).
person(beth, anna).
person(jason, anna).

parent(X, Y):- person(X, Y).
grandparent(X, Y):- person(X, T), person(T, Y).
ancestor(X, Y):- person(X, Y);
                 person(X, T), ancestor(T, Y).

and then on the right hand side, you'll write your queries. Enter the following query in the text box on the right hand side to see how it works: ancestor(tina, X).

From here, you can use this to work on your Prolog. When you're done working, you can either copy/paste the code to your computer locally in a facts.pl or facts.prolog file - or, you can make an account and save the file remotely and pull it back up again next time you go to the Swish editor.

Lisp

For working with Lisp, I highly recommend downloading a compiler. If you really don't want to for some reason, you can always use this online compiler: https://rextester.com/l/common_lisp_online_compiler But I'd recommend following the below steps to work on it locally.

Windows:

You can download Steel Bank Common Lisp from their website here: http://www.sbcl.org/platform-table.html Just select which platform you're using and it'll bring you to SourceForge to install download the Microsoft Installer file.

MacOS

Open your terminal, type brew install sbcl - that's all you need. Alternatively, the link above for Windows also has a link for MacOS.

Linux

If you're using Linux, I assume you're fairly used to installing packages like this - check if it's in your system package manager (apt-get install sbcl, pacman -S sbcl, etc)

Once you have a compiler installed, you'll need to set up your development environment:

VSCode

Install the following extension:

Atom

Vim

Emacs

  • Colour your matching parenthesis to easily know what matches up M-x package-install RET rainbow-delimiters-mode RET
  • Edit Lisp more like Python - automatically places parenthesis for you based on indentation M-x package-install RET parinfer RET
  • Syntax highlighting Emacs has it out of the box, if .lisp files don't trigger lisp-mode automatically, the just run M-x lisp-mode or add a hook for it in your init.el.

If you use a different editor than one of those 4, you're gonna have to look up how to do it yourself, I'm sure there's good support for Sublime at the very least, but I don't know about other editors.

Ruby

For Ruby, if you're not on Windows you should be able to install it through your system package manager (or brew on macOS). If you're on Windows, use this link to install: https://rubyinstaller.org/

For packages, Ruby is much more common of a language than Lisp, so packages should be easy. All you really need is syntax highlighting for Ruby.

C

For Windows, I'd recommend using CLion as an IDE and follow their tutorial on setting it up for Windows: https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html# They have lots of options there, I'd recommend following the Windows Subsystem for Linux setup instead of MinGW or Cygwin. Those are both outdated since WSL exists now.

For MacOS and Linux, you should already have the gcc compiler installed. MacOS you'll need to accept a EULA to enable it though, and it'll take some time to configure. You'll just have it on Linux though.

For compiling on macOS/Linux, you just need to use the gcc command. gcc filename.c and then that'll produce an executable file (often just a.o) and you can execute that file. When you get to mulitple files, I'd recommend looking at using CMake to manage your compiles. I don't know CMake very well, so ping @Experts:C/C++ on the Discord server if you'd like help with it.

If you want anymore help with anything, feel free to ping me or @Expert roles in the server in #programming_help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment