docs | ||
library | ||
planning | ||
programs | ||
tests | ||
tests2 | ||
theory_sims | ||
.cbas_cfg | ||
.gitattributes | ||
.gitignore | ||
ast_opt.c | ||
ast_opt.h | ||
astexec.c | ||
astexec.h | ||
builder_library.h | ||
CC0 | ||
code_validator.c | ||
constexpr.c | ||
constexpr.h | ||
COPYRIGHT_INFO.txt | ||
ctok.c | ||
data.c | ||
data.h | ||
featuretest.cbas | ||
gitconfig | ||
libmin.h | ||
LICENSE | ||
license_text.h | ||
lockstepthread.h | ||
main.c | ||
Makefile | ||
metaprogramming.c | ||
metaprogramming.h | ||
parser.c | ||
parser.h | ||
README.md | ||
reflection_library.c | ||
stringutil.h | ||
targspecifics.h |
Coder's Basilisk - the first of the last programming languages
Coder's Basilisk (or "CBAS"/"Seabass") is a self-modifying, self-extending, self-retargeting systems implementation language like C or C++.
Every single file in this repository resides entirely within the public domain.
It is my gift to you. Enjoy it.
What makes CBAS different from any other language?
In short: Metaprogramming. This is a real usable metaprogramming language.
It possesses an advanced compiletime execution engine which allows you to both read and modify the source code before it is parsed. This allows you to add new features to the language with few limits.
The compiletime execution is also responsible for generating the final output of the compiler, i.e. you write your own backend in the language itself. This means that well-written CBAS is pretty much perfectly portable - you can make CBAS compile to anything.
This is the first systems implementation language I know of to possess these traits in a pragmatic (rather than hypothetical or theoretical) fashion.
What can CBAS do?
In essence, what CBAS does is democratize and streamline the advancement of programming language technology. Adding small new features to CBAS is easy and will work with integrate with existing projects. Implementing new programming language features, and even entire new languages, is relatively simple and straightforward with CBAS.
Even if you don't particularly care for CBAS itself and care more about some other language, if you can write something in CBAS compiletime code that translates that other language into CBAS, you've essentially instantly gained the ability to mix-and-match that language with any other language which can be translated to CBAS, and to compile it to anything for which CBAS has a backend. Like LLVM but cooler.
All this said, I have by no means fully fleshed out my vision for CBAS nor explored every major avenue of what it can do. If you want to explore what I've presented here (and other ideas you may have) you will likely have to explore them on your own.
What can the tools that exist do right now?
There's the CBAS tool itself which obviously provides the underlying theoretical power.
A standard metaprogramming library exists to make writing compiletime (called 'codegen') code easier. Additionally, there is a fairly fleshed-out GNUC backend for the language. You can write programs in CBAS immediately and compile them using cbas and gcc/clang/tcc right now.
There are example programs for you to learn the language from as well as some forwarded C libraries (OpenGL 1.1 and OpenAL 1.1) to examine if you want to use the language yourself.
There are bugs, this is not thoroughly tested software, but I believe even in this unrefined state, what's here is immediately useful.
How do I get started?
First, build and test the compiler.
cc -O3 *.c -o cbas
# Read version printout
./cbas -v
# basic featuretest - test the compiletime language
./cbas featuretest.cbas
./cbas tests2/dirlist.cbas
cc auto_out.c -o dirlist -lm -lpthread
# Run the dirlist test program, should function sort of like 'ls' or 'DIR'
./dirlist .
# if all this worked your compiler is working
put 'cbas' somewhere on your PATH (like /usr/bin/) so you can invoke it by name like gcc
.
To make a new project, create a folder that looks like this:
MYPROJECT/
library/
.cbas_cfg
main.cbas
You can edit .cbas_cfg
to change where system includes go.
From there, edit main.cbas
, write other .hbas
and .cbas
files, set up your build system, and get going!
But how do I learn the language?
Read the existing documentation and then start reading example programs.
I want to write proper manuals and tutorials, but they don't exist yet. I recommend you go straight to reading the code that exists, starting with the compiler's own source code if you really want to understand it.
CBAS is a highly advanced tool and if you want to master it, I believe you need to learn it from the bottom up.
What license/permissions does this project have?
Everything here is public domain.