This commit is contained in:
Xircon 2026-07-30 03:35:16 -04:00
commit d1ab554b52
13 changed files with 114 additions and 0 deletions

2
.ccls Normal file
View File

@ -0,0 +1,2 @@
clang
%c -std=c++23

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
## IDE Stuff
.ccls-cache
.vscode
a.out
build

View File

@ -0,0 +1,5 @@
# Compiler
Compiler written in C++ (sorry for it being shit, tbh i hate C++ i just need its features, will be self hosted later on? i hope anyhow.)
Uses LLVM In the backend as it makes things... ALOT EASIER.
I'm not going to write every ounce of everything when this will just be re-written anyhow.

View File

@ -0,0 +1,2 @@
# File IO
TODO!

2
documentation/lang/IO.md Normal file
View File

@ -0,0 +1,2 @@
# Basic IO
TODO!

View File

@ -0,0 +1,50 @@
# Basic outline of the Lang
In this document is a simple and basic outline of how to use the lang, along with an Index of everything in the documentation and a small description of it.
## Hello World!
Here's a simple hello world:
```java
include <io> // This is where all basic I/O functions live
! Main Function
public static void main() { // Declare a function the exact same way as in java, does not HAVE to be public nor static, these are automatic
io.println("Hi world!"); // Println works the same as its java counterpart
return; // Return is not needed for void functions, but can still be used.
}
// Note, syntax highlighting here will not be great, as this is a custom lang markdown does not have support for it! So i'm just using the java syntax highlighter... lol
```
You'll notice the syntax is similar to that of Java, minus having to declare the class of course. As here theres no classes *just files* so no, you cannot have classes in classes... or can you? No, no you cannot.
They're useful, but honestly i dislike them and find it makes things messy. (yes i like to have 3000 files how'd you know.)
Anyhow, Comments are the same as in C or Java, you can annotate a function to say its use via ! \[USAGE\] it basically just works like a comment, but is designed specifically for saying what a function does and can only be used before a function declaration. Going on with similarities, include carries over from C, except you do not need to add a file extension ***ever*** similar to how imports in java work, tho differing from that as there is *no* static imports.
So like shown in the example to use something like println from the io package, you must type `io.println("");` and not `println("");` if something is inside the same file you do not need the package before it, but you can still do this it won't hurt anything.
### Compact Source File Hello World
Compact source files are... interesting? don't know how to put it other than that.
```java
include <io>
io.println("Hellord"); // Print Hellord!
return 0; // MUST Have a return value!
```
It MUST return an int, cannot take in any arguments and is just... shitty? but its nice for just shoving down some crap.
Basically its the exact same as this, just shorter and easier to write. Also has drawbacks... major ones! Like not being able to define functions within the compact file... of course.
```java
include <io>
int main() {
io.println("Hellord");
return 0;
}
```
## Some Goals
This section is just random goals with the lang ngl its a lot of bullshit
### 1. Memory Safety
Yes i know this is like... a major thing in everything now? i dunno... i just think its a good thing, though rust is aids cancer hell with its syntax imo. I much prefer Java or C syntax.
## Index Of The Documentation:
1. [Basic input and Output with the IO Package](./IO.md)
2. [File IO](./FIO.md)
3. [OS Package](./OS.md)

3
documentation/lang/OS.md Normal file
View File

@ -0,0 +1,3 @@
# Operating System Package
This package contains OS specific stuffs, such as syscalls.
Think of it like a binding for Windows.h or unistd.h

1
examples/compact.x Normal file
View File

@ -0,0 +1 @@
return 99;

6
examples/helloworld.x Normal file
View File

@ -0,0 +1,6 @@
include <io>
public static void main() {
io.println("Hello World!");
return;
}

3
examples/return0.x Normal file
View File

@ -0,0 +1,3 @@
int main() {
return 0;
}

View File

@ -0,0 +1,7 @@
int Int1 = 1
int Int2 = 2
int Int3 = 3
public static int main() {
return Int1 + Int2 * Int3;
}

View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.16)
project(xlang
LANGUAGES CXX
DESCRIPTION "XLANG Compiler")
enable_language(CXX)
set(CMAKE_CXX_COMPILER /bin/clang++)
set(CXX_STANDARD 23)
include_directories(BEFORE SYSTEM /usr/include ./)
link_directories(BEFORE $ENV{LD_LIBRARY_PATH} ${CMAKE_BINARY_DIR}/ )
include(GNUInstallDirs)
set(SOURCES ./main.cxx
CACHE INTERNAL "") # Make this all files MINUS main.cxx dunno how tbh lmao
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(
${PROJECT_NAME}
)

6
src/compilier/main.cxx Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main() {
std::cout << "Cuntout" << std::endl;
return 0;
}