RAAAAAAAAAAAAAAH

This commit is contained in:
Tyler McGurrin 2025-10-14 11:57:11 -04:00
parent 3acb3bde5d
commit 4e9354a3d9
8 changed files with 51 additions and 31 deletions

View File

@ -1,14 +1,9 @@
cmake_minimum_required(VERSION 3.14.0)
project(xic
LANGUAGES C
DESCRIPTION "XILANG Compilier"
)
cmake_minimum_required(VERSION 3.25.0)
project(xic)
set(CVERSION "-std=c99")
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CVERSION}")
add_executable(${PROJECT_NAME} src/main.c)
add_executable(${PROJECT_NAME} src/main.cxx)
target_link_libraries(
${PROJECT_NAME}

View File

@ -1 +1,3 @@
# Xircon-s-Lang
A language and a compiler with decent documentation, uses nasm under the hood as an assembler

View File

@ -6,7 +6,7 @@ A short and relatively detailed list of all the basics of XILANG. Also yes, the
* `ret` then a value (can be a numeral or a string) will return that value
* `func` then a name (ex: `func main() {}`) allows you to define a new function
* `import` and a filename (either in `""` or `<>` depending on if it is a local file in the dir or a file from the include path, similar to C) allows you to import the functions from another file
* `import` and a filename (either in `""` or `<>` depending on if it is a local file in the dir or a file from the include path, similar to C) allows you to import the functions from another file (ex: `import Example.xh`)
* `print` then a value will allow to print a character or string to the screen (you can also print any other type of varible)
## Defining Varibles
@ -19,6 +19,12 @@ you define something by doing the type of var you want to define then a name the
* `string` for a string value (the value MUST be wrapped in `""`s!)
* `char` for a single character value (must be wrapped in `''`s!)
## Ifs and Loops
* `if` is pretty simple its just `if x = y {do this}`
* `loop` is a bit more... dangerous. you can loop... well... basically forever if you were to... forget the value... `loop 100 {print "This"}` or `loop {print "This"}` are both valid ways to use loop, one does the same thing 100 times the other does it until your CPU stops CPUing.
* `while` does something while something is true, for example `while x = 1 {print "This"}` or `while x > 1 {print "This"}`
## A Basic Program
A Basic program that just prints text and then returns.

View File

@ -0,0 +1,4 @@
# File Types
* `*.x` main file same as a `*.c` file is in C
* `*.xh` basically the same idea as a C header file

View File

@ -0,0 +1,7 @@
# Types Of Variables
outlines how these work under the hood i guess...
## Boolean
Under the hood its basically just an int... with a value of either 1 or 0 (1 being true 0 being false)
for example if you wanted to set an int to 1 *technically* you can do this `int Example = true` as a boolean is just an int internally.

View File

@ -1,4 +1,7 @@
;This is a comment
main:
ret
global _start
_start:
mov rax, 60
mov rsi, 0
syscall

View File

@ -1,19 +0,0 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#define version "RD-00001"
int main(int argC, char *argV[])
{
if(argC != 1) {
for( int i=1; i < argC; i++) {
if (strcmp(argV[i], "-v") == false) { printf("Xircon's Lang Compilier %s\n", version); return false;}
}
} else {
printf("Usage: %s [OPTIONS] [SERVER] [PORT]\n", argV[0]);
return true;
}
}

22
src/main.cxx Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
#include <fstream>
#include <sstream>
#define version "RD-00002"
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
int main(int argC, char *argV[]) {
if(argC > 2) {
std::cerr << "Usage: xic [OPTIONS] [INPUT FILE]\n" << std::endl;
return EXIT_FAILURE;
}
std::fstream input(argV[1], std::ios::in);
std::stringstream contents_stream;
contents_stream << input.rdbuf();
input.close();
return 0;
}