Introduction
Dawn (dwn) is a new programming language designed to be simple, fast, and powerful. It is currently under development, but contains features available in most programming languages:
- Variable creation
- Operators
- Loops
- If blocks
- Custom Functions (without arguments)
This guide is intended to help you get started with Dawn.
License
The dwn
source and documentation are release are released under the GNU GPL v3 license.
Getting Started
Let's start your Dawn journey! There's a lot to learn; in this chapter, we will learn to:
- Install the Dawn (
dwn
) executable - Create a simple
Hello, world!
program and run it.
Note: Replace
<path to dawn program directory>
with the location where you want to store your Dawn (dwn
) program file. Also replace<path to executable>
with the location of the Dawn (dwn
) executable
Installation
There are multiple ways to install the dwn
CLI tool. Choose any one of the methods below that best suit your needs.
Pre-compiled binaries
Executable binaries are available for download on the GitHub Releases page. Download the binary for your platform (Windows, macOS, or Linux). Locate the binary and do the following:
MacOS and Linux
sudo mkdir -p /usr/local/bin # Enter your password if it asks for it.
sudo mv <path to executable> /usr/local/bin
dwn --help
Windows
(CMD)
mkdir "C:\Program Files\Dawn"
move <path to executable> "C:\Program Files\Dawn\"
dwn.exe --help
(PowerShell)
New-Item -ItemType Directory -Path "C:\Program Files\Dawn" -Force
Move-Item –Path <path to executable> -Destination "C:\Program Files\Dawn\"
& "dwn.exe" "--help"
Hello, World!
Now that you have installed Dawn (dwn
), it is time to write your first Dawn program! It is traditional when learning a new programming language to write a little program that prints the text Hello, world!
to the screen, so we’ll do the same here!
Creating the project file
You may use any IDE, text editor or command line to create your first Dawn program. Dawn program files end with the extension .dwn
.
If you are using command line, create an empty Dawn program file with:
MacOS and Linux
cd <path to dawn program directory>
touch code.dwn
Windows
(CMD)
cd <path to dawn program directory>
copy NUL code.dwn
(PowerShell)
Set-Location -Path <path to dawn program directory>
New-Item code.dwn -type file
Adding the content
Open the file and add the following text:
say "Hello, world!"
Then, open a command prompt or terminal and run the following:
MacOS and Linux
dwn run code.dwn
Windows
(CMD)
dwn.exe run code.dwn
(PowerShell)
& "dwn.exe" "run" "code.dwn"
Result
You should get:
Hello, world!
Variables
In Dawn, variables are created like this:
let a = "Hello"
where a
is the variable name and "Hello"
is the value.
Data Types
There are 4 data types in Dawn:
Data Types | Meaning |
---|---|
int | Integers (all numbers except decimals and fractions) |
float | All decimals, fractions and integers |
string | The value between quotation marks |
boolean | true / false |
NOTE: int
s take up less memory that float
s and thus are more efficient.