Skip to content

Latest commit

 

History

History
192 lines (146 loc) · 2.43 KB

File metadata and controls

192 lines (146 loc) · 2.43 KB

JPP - Tools guide


C/C++

# Installation:
# gcc
sudo apt install gcc
gcc --version

# g++
sudo apt install g++
g++ --version
# Usage:
# gcc
gcc -o <binary-name> <program>.c
./<program>

# g++
g++ -o <binary-name> <program>.cpp
./<program>

Ada

# Installation:
sudo apt install gnat
gnat compile --version
# Usage:
# Compile (out: binary) & run
gnatmake <program>.adb
./<program>

# Clean
gnatclean <program>

Java

# Installation:
sudo apt install openjdk-17-jdk
java --version
# Usage:
javac <program>.java
java <program>
# Building a simple maven project:
mvn archetype:generate -DgroupId="com.PROJECT_NAME.app" -DartifactId="APP_NAME" -DarchetypeArtifactId="maven-archetype-quickstart" -DarchetypeVersion="1.4" -DinteractiveMode="false"

# Running tests:
cd <project-dir>/<APP_NAME>
mvn test

GoLang

# Installation:
sudo apt install go
go version
# Install specific version, eg. 1.21.2:
wget https://go.dev/dl/go1.21.2.linux-amd64.tar.gz
sudo tar -xvf go1.21.0.linux-amd64.tar.gz
sudo mv go /usr/local

# Add the following to ~/.bashrc
export GOPATH="/usr/local/go"
export PATH="$PATH:$GOPATH/bin"

# In terminal
source ~/.bashrc
go version
# Usage:
go mod init <module>

# Compile (out: binary)
go build -o <binary-name> <program>.go
./<program>

# Run (without compilation)
go run <program>.go

Haskell

# Installation:
sudo apt install ghc
ghc --version
# Usage:
# Compile (out: binary)
ghc <program>.hs
./<progam>

Common Lisp

# Installation:
sudo apt install clisp
clisp --version
# Usage:
# Compile & run
clisp -c <program>.lisp
clisp -x '(load "<program>.fas")'

# Run (without compilation)
clisp <program>.lisp

Standard ML

# Installation:
sudo apt install smlnj
sml --version # Ctrl+D to exit
# Usage:
sml -m < <program>.sml

Prolog

# Installation:
sudo apt install swi-prolog
swipl --version
# Usage:
swipl -s <program>.pl
# In the interpreter:
?- <main-func>.

NOTE: This can be encapsulated to a run.sh bash script

#!/bin/bash
# Load the Prolog file and execute the main function
swipl -g "consult('$1'), $2, halt." -t 'halt.'
# Usage:
./run.sh <program>.pl <main-func>