RAAAAAAAAAAAAAAH
This commit is contained in:
parent
3acb3bde5d
commit
4e9354a3d9
@ -1,14 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.14.0)
|
cmake_minimum_required(VERSION 3.25.0)
|
||||||
project(xic
|
project(xic)
|
||||||
LANGUAGES C
|
|
||||||
DESCRIPTION "XILANG Compilier"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(CVERSION "-std=c99")
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CVERSION}")
|
add_executable(${PROJECT_NAME} src/main.cxx)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} src/main.c)
|
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
|
|||||||
@ -1 +1,3 @@
|
|||||||
# Xircon-s-Lang
|
# Xircon-s-Lang
|
||||||
|
|
||||||
|
A language and a compiler with decent documentation, uses nasm under the hood as an assembler
|
||||||
@ -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
|
* `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
|
* `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)
|
* `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
|
## 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!)
|
* `string` for a string value (the value MUST be wrapped in `""`s!)
|
||||||
* `char` for a single character 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
|
||||||
|
|
||||||
A Basic program that just prints text and then returns.
|
A Basic program that just prints text and then returns.
|
||||||
|
|||||||
4
documentation/Filetypes.md
Normal file
4
documentation/Filetypes.md
Normal 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
|
||||||
7
documentation/Variable Types.md
Normal file
7
documentation/Variable Types.md
Normal 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.
|
||||||
@ -1,4 +1,7 @@
|
|||||||
;This is a comment
|
;This is a comment
|
||||||
|
|
||||||
main:
|
global _start
|
||||||
ret
|
_start:
|
||||||
|
mov rax, 60
|
||||||
|
mov rsi, 0
|
||||||
|
syscall
|
||||||
19
src/main.c
19
src/main.c
@ -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
22
src/main.cxx
Normal 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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user