Install & Setup - For the Engineer¶
Command-line tool¶
The ALFA command-line should be downloaded and installed as per the platform in use.
Windows¶
Follow steps in ALFA in VSCode to download and install the alfa
command line tool.
Mac/Linux¶
Create a directory
$HOME/tools/alfa
to install the ALFA CLI. If an alternate path is used, change the path in the steps below accordingly. The remaining steps download the AlfaPackage-3.4.0.zip and unzips the contents.mkdir -p $HOME/tools/alfa cd $HOME/tools/alfa curl -L --http1.1 http://alfa-lang.io/downloads/AlfaPackage-3.4.0.zip --output AlfaPackage-3.4.0.zip unzip AlfaPackage-3.4.0.zipAdd the following to your
~/.profile
, or shell profile file (e.g: On a Mac~/.zprofile
,~/.bash_profile
etc.)# ALFA settings after unzipping AlfaPackage-3.4.0.zip export ALFA_HOME=$HOME/tools/alfa PATH="${PATH}:$ALFA_HOME/bin" export PATHFollowing the VS Code Plugin installation steps in ALFA in VSCode for installing ALFA support in VS Code for Mac/Linux.
Verify Installation¶
Once setup on Mac/Linux/Windows, it should be possible to open a new terminal or command window and typealfa -h
and view command line usage help.
Maven plugin¶
Prerequisite: Maven (version 3 or higher) command line tool, confirm by running
mvn -v
on your terminal window.For details on using the plugin and a complete example of using Maven, see ALFA Maven Plugin.
Test Drive¶
Number of examples are available in Example Projects that can be downloaded and evaluated. Open the downloaded and unzipped example project using VS Code once the ALFA support is installed.
Create a new file
sample.alfa
using VS Code and paste the following.record Club.Player { Name : string Age : int Average : double RankingByYear : map< int, int > }
Try changing the definition with new fields/types.
Optionally, run command line and compile the new file.
alfa -c sample.alfa