commit d1ab554b52d1e0df50d2b47c6a9a2db37919540e Author: Xircon Date: Thu Jul 30 03:35:16 2026 -0400 kill me diff --git a/.ccls b/.ccls new file mode 100644 index 0000000..551a1af --- /dev/null +++ b/.ccls @@ -0,0 +1,2 @@ +clang +%c -std=c++23 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..848328c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +## IDE Stuff +.ccls-cache +.vscode +a.out +build \ No newline at end of file diff --git a/documentation/compilier/Main.md b/documentation/compilier/Main.md new file mode 100644 index 0000000..10a50ab --- /dev/null +++ b/documentation/compilier/Main.md @@ -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. \ No newline at end of file diff --git a/documentation/lang/FIO.md b/documentation/lang/FIO.md new file mode 100644 index 0000000..f7613b5 --- /dev/null +++ b/documentation/lang/FIO.md @@ -0,0 +1,2 @@ +# File IO +TODO! \ No newline at end of file diff --git a/documentation/lang/IO.md b/documentation/lang/IO.md new file mode 100644 index 0000000..ae689c8 --- /dev/null +++ b/documentation/lang/IO.md @@ -0,0 +1,2 @@ +# Basic IO +TODO! \ No newline at end of file diff --git a/documentation/lang/Main.md b/documentation/lang/Main.md new file mode 100644 index 0000000..8c45857 --- /dev/null +++ b/documentation/lang/Main.md @@ -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 // 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.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 + +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) \ No newline at end of file diff --git a/documentation/lang/OS.md b/documentation/lang/OS.md new file mode 100644 index 0000000..211d5a6 --- /dev/null +++ b/documentation/lang/OS.md @@ -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 \ No newline at end of file diff --git a/examples/compact.x b/examples/compact.x new file mode 100644 index 0000000..f0025da --- /dev/null +++ b/examples/compact.x @@ -0,0 +1 @@ +return 99; \ No newline at end of file diff --git a/examples/helloworld.x b/examples/helloworld.x new file mode 100644 index 0000000..0df1e11 --- /dev/null +++ b/examples/helloworld.x @@ -0,0 +1,6 @@ +include + +public static void main() { + io.println("Hello World!"); + return; +} \ No newline at end of file diff --git a/examples/return0.x b/examples/return0.x new file mode 100644 index 0000000..e9cdae1 --- /dev/null +++ b/examples/return0.x @@ -0,0 +1,3 @@ +int main() { + return 0; +} \ No newline at end of file diff --git a/examples/returnvaribles.x b/examples/returnvaribles.x new file mode 100644 index 0000000..bf498b9 --- /dev/null +++ b/examples/returnvaribles.x @@ -0,0 +1,7 @@ +int Int1 = 1 +int Int2 = 2 +int Int3 = 3 + +public static int main() { + return Int1 + Int2 * Int3; +} \ No newline at end of file diff --git a/src/compilier/CMakeLists.txt b/src/compilier/CMakeLists.txt new file mode 100644 index 0000000..5eaa688 --- /dev/null +++ b/src/compilier/CMakeLists.txt @@ -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} +) \ No newline at end of file diff --git a/src/compilier/main.cxx b/src/compilier/main.cxx new file mode 100644 index 0000000..f5e0484 --- /dev/null +++ b/src/compilier/main.cxx @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Cuntout" << std::endl; + return 0; +} \ No newline at end of file