The Scale Programming Language
Introduction
Scale is a procedual and object oriented concatenative stack oriented compiled programming language inspired by Lua and Porth.
Scale and C can interoperate using a header file named scale_support.h
, which will be generated when compiling a scale file with the -t
option. If you have any scale functions marked with the export
modifier, C-declarations for those functions will appear in the file. Functions marked with the expect
keyword are expected to be implemented in a different translation unit, i.e. your C-code.
The Compiler is a source-to-source compiler, as it converts your source code to valid C code, that is then compiled by GCC.
Scale supports both 32-bit and 64-bit systems, but 64-bit is recommended.
Installation
Install a release
Linux & macOS
Go to the Releases tab and download the latest source.zip
. Then:
$ unzip source.zip
$ sh install.sh
Windows
Windows is not supported directly. To use Scale, follow the Linux install instructions inside of WSL.
Install stable dev
Linux & macOS
$ git clone https://github.com/StonkDragon/Scale
$ sh install.sh
Windows
Windows is not supported directly. To use Scale, follow the Linux install instructions inside of WSL.
Dependencies
Scale has the following dependencies:
Required:
gcc
(or similar C compiler)dragon
(The install.sh script will install this for you)
Documentation
The documentation can be viewed at stonkdragon.ml/Scale. Alternatively you can run one of the following commands:
$ sclc -doc categories
$ sclc -doc info
Scale Framework Documentation
The documentation can be viewed at stonkdragon.ml/Scale. Alternatively you can run the following command:
$ sclc -doc-for Scale
Examples
Examples can be found in the examples directory.
Here is a list of examples that should explain some of the syntax and practices in Scale:
- Hello World
- Operators
- If-Statement
- Variables in Scale
- While-Loop
- Fibonacci Numbers
- For-Loop
- Switch Expression
- For-Loop with step
- Repeat-Block
- FizzBuzz
- Function Arguments
- Container Introduction
- Structure Introduction
- C Declaration codeblock
- Labels and Goto
- Object-Oriented Programming in Scale
- Foreach-Loop
Build
The Scale compiler uses Dragon as the build system. It is required to build the compiler.
To build the compiler, execute the following command from the root directory of the repository:
$ dragon build
This will build the compiler, move the binary to your /usr/local/bin
folder, and run tests.
License
Scale is licensed under the MIT license.