nim
Nim is a scripting language designed to support a variety of convenient target languages for compilation.
Useful Links
- Nim Website
- Wikipedia page
- 99 Bottles of Beer Program, courtesy LT Moeller:
proc get_beer(): void = echo "Go to the store and buy some more, 99 bottles of beer on the wall" proc drink_beer(n: int): void = if n == 0: echo "No more bottles of beer on the wall, no more bottles of beer.\n" elif n == 1: echo "1 bottle of beer on the wall, 1 bottle of beer." echo "Take one down and pass it around, no more bottles of beer on the wall.\n" else: echo n, " bottles of beer on the wall, ", n, " bottles of beer" echo "Take one down and pass it around, ", n-1, " bottles of beer on the wall.\n" for i in countdown(99, 0): drink_beer(i) get_beer()
Tools
The nim compiler we'll use for this project is version 0.17.2.
Everything you need is already installed on CS department lab machines.
To install on your virtual machine, follow these steps:
-
Run
sudo apt install -y nim
How I will run your code
The programs you submit should be in a single file
called proj.nim
, for either part of the project.
I will test your code by running the following commands
using the software available in the lab environment or using the instructions
above:
nim c proj.nim ./proj
Phase 1 Requirements
For this language, you need to implement modifications B,C,D,F,G, H, and J. See the Phase 1 page for details on what this means.
Phase 2
See the Phase 2 Page for the list of suggested
problems. Of the ones listed, I recommend the following as being most
well-suited for LANGUAGE:
- Matrix Calculator
- Image Creator
- Game Scheduler
- Hangman
- TODO list
- Game with hidden agenda
- Guess the language
- Sports Ticker
- Rock, Paper, Scissors
- Music Maker
- ??? (you choose!)