BCL (BCL Compiled Language) is a compiled programming language that is inspired by python, rust, and other languages.
To do this you will need:
- LLVM 14 (or LLVM11 if using alternative fork)
- Conda
- Python 3.11+
- SetupTools (
pip install setuptools
) - Git (required for pip)
- Visual Studio (When on windows)
Clone the git repo
run these commands
This is for all platforms. There is only one linux exclusive command.
# libs required to compile llvmlite from source/custom fork
## linux gcc stuff, I couldn't get it to compile without this
conda install -c conda-forge libstdcxx-ng=12
## llvm14 install (change 14 to 11 if needed)
conda install -y -q -c numba/label/dev llvmdev="14.*" libxml2
## llvm uses cmake
conda install cmake
Installing llvm 11
# when using a different version of visual studio, do:
set CMAKE_GENERATOR=Visual Studio 17 2022 # an example version of visual studio.
# Install LLVM11. I haven't found a way to use 14 on windows.
pip install git+https://github.com/spidertyler2005/llvmlite.git
Installing llvmlite 14 or 11
# Installing custom llvmlite fork that has lld for linking (LLVM14)
pip install git+https://github.com/Hassium-Software/llvmlite-lld.git
# Alternatively, if this doesn't work install (LLVM11)
pip install git+https://github.com/spidertyler2005/llvmlite.git
installing BCL
# Installing BCL
pip install .
run bcl <subcommand> <args>
to use BCL!
run pip uninstall Bens_Compiled_Language
// fizzbuzz program
// ===================
import stdlib::*; // will later be an auto-import
define main() {
for i in 0..100 {
// printf is in the language, could be used here too!
print(i);
print(' ');
if is_multiple(i, 3) {
print("fizz");
}
if is_multiple(i, 5) {
print("buzz");
}
println();
}
}
define is_multiple(value: i32, divider: i32) -> bool {
return (value % divider) == 0;
}
The language is not fit for production use. It is missing a very large number of features. Although, it is turing-complete.
- codeblocks
- functions
- function returns
- function arguments
- variable declaration and assignment
- most Operators (now with 100% more bitwise ops)
- boolean operators
- if and else statements
- while loops
- floats
- variable type declaration
- variable assignment-operators (
+=
,-=
, etc) - Arrays
- for-loops (only with range literals rignt now)
- references
-
const
ants - structs
- struct functions
- struct methods
- struct operator overloading
- struct generic typing
- protocol types
- generator functions/iterators
-
import
statement with the ability to import modules/packages (WIP, needs namespaces) - compile a folder or file instead of hardcoded test string.
- heap allocation with garbage collection (
Box::<T>
) -
malloc
andfree
functions (If you manage your own memory instead of usingBox::<T>
) - in-line assembly functionality.
- make sys-calls
-
some access to llvm function directly. (notice: more can, and will, be added)disabled temporarily - access to cpu registers.
- standard math library (VERY VERY WIP)
- string (literal)
- strings (mutable)
- vectors (WIP)
- stdio library (VERY WIP)
- run-time errors (Error type for errors as values.,
Result::<T, E>
) - Option type (
Optional::<T>
) - namespaces
- enums
There is a folder called syntax_highlighting
, inside there is a vsix file which you can right click to install. Just note that it's a bit of a work in progress.
Sphinx documentation can be found in the docs
folder. Note that these docs are not up-to-date yet.