Mark it as complete
This commit is contained in:
18
README.md
18
README.md
@@ -1,8 +1,18 @@
|
|||||||
# The Core Language
|
# The Core Language
|
||||||
|
|
||||||
A statically typed systems programming language that **you shouldn't use**, I'm NOT joking.
|
A statically typed systems programming language that **you shouldn't use**.
|
||||||
|
I mark it as complete, it's pretty buggy but I had a lot of fun making it.
|
||||||
|
Learned a lot about language design and implementation, very worthwhile experience.
|
||||||
|
If you are intersted in programming languages, checkout bottom of the readme (there are useful resources there!).
|
||||||
|
The language is usable,
|
||||||
|
it lacks a macro system/generics for full convenience. It can be combined with C preprocessor
|
||||||
|
or python but where is fun in that?
|
||||||
|
Generics seem easy but I wanted something more powerful with compile time tree rewriting capabilities
|
||||||
|
but thats complicated, I dont have good design for that. :(
|
||||||
|
|
||||||
|
|
||||||
The basic premise of the language is simplicity and debuggability,
|
The basic premise of the language is simplicity and debuggability,
|
||||||
reinforcing already useful ideas from C,C++,Go,Odin,Jai and shaving off round edges. In the future it might become a single/two file, easily embeddable library language with optional fixed-size allocation scheme and stb libraries style design.
|
reinforcing already useful ideas from C,C++,Go,Odin,Jai and shaving off round edges.
|
||||||
|
|
||||||
## Simple drawing to window example
|
## Simple drawing to window example
|
||||||
|
|
||||||
@@ -24,11 +34,11 @@ main :: (): int
|
|||||||
|
|
||||||
* **Debuggers**(Visual Studio, Remedybg) **fully work** with the language, you can step through the program
|
* **Debuggers**(Visual Studio, Remedybg) **fully work** with the language, you can step through the program
|
||||||
* **No external dependencies**, you just setup clang and call build.bat
|
* **No external dependencies**, you just setup clang and call build.bat
|
||||||
* **No heap allocation** during lifetime of the compiler
|
|
||||||
* Compiles to C code, in the future it will also compile to bytecode and hopefully a raw x64 executable
|
* Compiles to C code, in the future it will also compile to bytecode and hopefully a raw x64 executable
|
||||||
* Very strict Go like type system with untyped literals
|
* Very strict Go like type system with untyped literals
|
||||||
* **Order independent declarations**
|
* **Order independent declarations**
|
||||||
* Module system, user namespaces the library, only the used library code gets compiled
|
* Module system
|
||||||
|
* Tree shaking (unused code is not compiled)
|
||||||
* **Windows and Linux**(only tested on Ubuntu) support
|
* **Windows and Linux**(only tested on Ubuntu) support
|
||||||
* Conditional compilation
|
* Conditional compilation
|
||||||
* Runtime type reflection
|
* Runtime type reflection
|
||||||
|
|||||||
@@ -430,33 +430,6 @@ GetTypeInfo :: (type: Type): *Type_Info
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef void Ast_Visit_Callback(Ast *ast);
|
typedef void Ast_Visit_Callback(Ast *ast);
|
||||||
// @todo: We are traversing the modules multiple times cause they can have multiple connections, need to add visit id
|
|
||||||
void ast_list_rewrite_callback(Ast *ast) {
|
|
||||||
switch(ast->kind) {
|
|
||||||
CASE(CALL, Call) {
|
|
||||||
if (node->name->kind == AST_IDENT) {
|
|
||||||
Ast_Atom *ident = (Ast_Atom *)node->name;
|
|
||||||
if (pctx->intern("List_Insert"_s) == ident->intern_val) {
|
|
||||||
Ast_Decl *list_insert = search_for_single_decl(pctx->custom_module, pctx->intern("List_Insert"_s), false);
|
|
||||||
if (!list_insert) {
|
|
||||||
custom_parse_string(R"(
|
|
||||||
List_Insert :: (list: List, node: Node)
|
|
||||||
if list.first == 0
|
|
||||||
list.first = node
|
|
||||||
list.last = node
|
|
||||||
else
|
|
||||||
list.last.next = node
|
|
||||||
list.last = node
|
|
||||||
)"_s);
|
|
||||||
list_insert = search_for_single_decl(pctx->custom_module, pctx->intern("List_Insert"_s), false);
|
|
||||||
}
|
|
||||||
assert(list_insert);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BREAK();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ast_visit(uint32_t visit_id, Ast_Visit_Callback *callback, Ast *ast) {
|
void ast_visit(uint32_t visit_id, Ast_Visit_Callback *callback, Ast *ast) {
|
||||||
if (!ast) return;
|
if (!ast) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user