Init
This commit is contained in:
parent
0569347a6b
commit
3acb3bde5d
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.ccls-cache/
|
||||
.vscode/
|
||||
build/
|
||||
15
CMakeLists.txt
Normal file
15
CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.14.0)
|
||||
project(xic
|
||||
LANGUAGES C
|
||||
DESCRIPTION "XILANG Compilier"
|
||||
)
|
||||
|
||||
set(CVERSION "-std=c99")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CVERSION}")
|
||||
|
||||
add_executable(${PROJECT_NAME} src/main.c)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
)
|
||||
13
LICENSE
Normal file
13
LICENSE
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2025 Tyler McGurrin (AKA Xircon)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
4. Commercial Exploitation from the redistribution of this software is strictly forbidden.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
34
documentation/Basics.md
Normal file
34
documentation/Basics.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Basics in Xircon's Lang (XILANG)
|
||||
|
||||
A short and relatively detailed list of all the basics of XILANG. Also yes, the name is supposed to be all caps *always* just like older FORTRAN.
|
||||
|
||||
## Extremly Basic Functions
|
||||
|
||||
* `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
|
||||
* `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
|
||||
|
||||
you define something by doing the type of var you want to define then a name then an = and the value of it (ex: `float Example = 1.0;`)
|
||||
|
||||
* `int` will allow you to define an integer value, just like in C
|
||||
* `float` for a floating point value
|
||||
* `boolean` for a boolean value (true or false)
|
||||
* `string` for a string value (the value MUST be wrapped in `""`s!)
|
||||
* `char` for a single character value (must be wrapped in `''`s!)
|
||||
|
||||
## A Basic Program
|
||||
|
||||
A Basic program that just prints text and then returns.
|
||||
|
||||
```!This is a Comment.
|
||||
string hi = "Hello";
|
||||
|
||||
func main() {
|
||||
print hi," World!";
|
||||
ret 0;
|
||||
}
|
||||
```
|
||||
This small prgram will print `Hello World!` and return 0.
|
||||
4
examples/return.s
Normal file
4
examples/return.s
Normal file
@ -0,0 +1,4 @@
|
||||
;This is a comment
|
||||
|
||||
main:
|
||||
ret
|
||||
5
examples/return.x
Normal file
5
examples/return.x
Normal file
@ -0,0 +1,5 @@
|
||||
!This is a Comment
|
||||
|
||||
func main() {
|
||||
ret 0;
|
||||
}
|
||||
19
src/main.c
Normal file
19
src/main.c
Normal file
@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user