diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bfab37c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "files.associations": { + "*.cjson": "jsonc", + "*.wxss": "css", + "*.wxs": "javascript", + "utf8.h": "c" + } +} \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..2bd7c3c --- /dev/null +++ b/Readme.md @@ -0,0 +1,3 @@ +#### Dependancies +utf8.h - https://github.com/sheredom/utf8.h +raylib - https://github.com/raysan5/raylib \ No newline at end of file diff --git a/bin/lingc.exe b/bin/lingc.exe new file mode 100644 index 0000000..32c2125 Binary files /dev/null and b/bin/lingc.exe differ diff --git a/bin/raylib.dll b/bin/raylib.dll new file mode 100644 index 0000000..6424378 Binary files /dev/null and b/bin/raylib.dll differ diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..02e34bd --- /dev/null +++ b/build.bat @@ -0,0 +1,10 @@ +@REM mkdir if not exist .\build +if not exist .\build mkdir .\build +gcc -o .\build\main.o -c .\src\main.c + +if not exist .\bin mkdir .\bin +gcc -o .\bin\lingc.exe .\build\main.o .\lib\win_64\raylib.dll + +copy .\lib\win_64\raylib.dll .\bin\raylib.dll + +@echo Build Done! \ No newline at end of file diff --git a/build/main.o b/build/main.o new file mode 100644 index 0000000..fdb4506 Binary files /dev/null and b/build/main.o differ diff --git a/lib/win_64/libraylib.a b/lib/win_64/libraylib.a new file mode 100644 index 0000000..9c14cfd Binary files /dev/null and b/lib/win_64/libraylib.a differ diff --git a/lib/win_64/libraylibdll.a b/lib/win_64/libraylibdll.a new file mode 100644 index 0000000..3665ba9 Binary files /dev/null and b/lib/win_64/libraylibdll.a differ diff --git a/lib/win_64/raylib.dll b/lib/win_64/raylib.dll new file mode 100644 index 0000000..6424378 Binary files /dev/null and b/lib/win_64/raylib.dll differ diff --git a/rebuild.bat b/rebuild.bat new file mode 100644 index 0000000..e67370b --- /dev/null +++ b/rebuild.bat @@ -0,0 +1,8 @@ +@echo off +@REM delete if exist .\bin +if exist .\bin rmdir /s /q .\bin +@REM delete if exist .\build +if exist .\build rmdir /s /q .\build + +call build.bat +@echo on \ No newline at end of file diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..391ee97 --- /dev/null +++ b/run.bat @@ -0,0 +1,2 @@ +call build.bat +.\bin\lingc.exe \ No newline at end of file diff --git a/src/Entities_Source/E_Function.c b/src/Entities_Source/E_Function.c new file mode 100644 index 0000000..9027248 --- /dev/null +++ b/src/Entities_Source/E_Function.c @@ -0,0 +1,12 @@ +#include "import.h" +#include "E_Function.h" + +typedef struct { + int id; + int index; + string name; + string returns[RULE_FUNCTION_RETURN_MAX]; + byte returns_count; + string params[RULE_FUNCTION_PARAM_MAX]; + byte params_count; +} E_Function; \ No newline at end of file diff --git a/src/Entities_Source/E_Function.h b/src/Entities_Source/E_Function.h new file mode 100644 index 0000000..5d3c28a --- /dev/null +++ b/src/Entities_Source/E_Function.h @@ -0,0 +1,6 @@ +#ifndef E_FUNCTION_H__ +#define E_FUNCTION_H__ + +typedef struct E_Function E_Function; + +#endif \ No newline at end of file diff --git a/src/Entities_Source/E_StaticVar.c b/src/Entities_Source/E_StaticVar.c new file mode 100644 index 0000000..1fc8ecc --- /dev/null +++ b/src/Entities_Source/E_StaticVar.c @@ -0,0 +1,9 @@ +#include "import.h" +#include "E_StaticVar.h" + +typedef struct { + int id; + int index; + string name; + string value; +} E_StaticVar; \ No newline at end of file diff --git a/src/Entities_Source/E_StaticVar.h b/src/Entities_Source/E_StaticVar.h new file mode 100644 index 0000000..f930c32 --- /dev/null +++ b/src/Entities_Source/E_StaticVar.h @@ -0,0 +1,6 @@ +#ifndef E_STATICVAR_H__ +#define E_STATICVAR_H__ + +typedef struct E_StaticVar E_StaticVar; + +#endif \ No newline at end of file diff --git a/src/Entities_Source/export.h b/src/Entities_Source/export.h new file mode 100644 index 0000000..05500bf --- /dev/null +++ b/src/Entities_Source/export.h @@ -0,0 +1,6 @@ +#ifndef ENTITIES_SOURCE_EXPORT_H__ +#define ENTITIES_SOURCE_EXPORT_H__ + +#include "E_StaticVar.h" + +#endif \ No newline at end of file diff --git a/src/Entities_Source/import.h b/src/Entities_Source/import.h new file mode 100644 index 0000000..d6a42fc --- /dev/null +++ b/src/Entities_Source/import.h @@ -0,0 +1,6 @@ +#ifndef ENTITIES_SOURCE_IMPORT_H__ +#define ENTITIES_SOURCE_IMPORT_H__ + +#include "../Generic.h" + +#endif \ No newline at end of file diff --git a/src/Generic.h b/src/Generic.h new file mode 100644 index 0000000..b981449 --- /dev/null +++ b/src/Generic.h @@ -0,0 +1,22 @@ +#ifndef GENERIC_H__ +#define GENERIC_H__ + +#include + +#ifndef bool +#define bool unsigned char +#define true 1 +#define false 0 +#endif + +#define PLogNA(x) printf("%s:%d %s", __FILE__, __LINE__, x) +#define PLog(x, ...) printf("%s:%d ", __FILE__, __LINE__); printf(x, __VA_ARGS__) + +#define string utf8_int8_t * +#define byte unsigned char + +// ==== Rule ==== +const int RULE_FUNCTION_RETURN_MAX = 8; +const int RULE_FUNCTION_PARAM_MAX = 32; + +#endif \ No newline at end of file diff --git a/src/Repo/RP_Source.h b/src/Repo/RP_Source.h new file mode 100644 index 0000000..217089b --- /dev/null +++ b/src/Repo/RP_Source.h @@ -0,0 +1,6 @@ +#ifndef RP_SOURCE_H__ +#define RP_SOURCE_H__ + +typedef struct RP_Source RP_Source; + +#endif \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..afc59c1 --- /dev/null +++ b/src/main.c @@ -0,0 +1,18 @@ +#include +#include +#include "Generic.h" + +int main(int argc, char **argv) { + string str = "Hello, world!%d\n"; + PLog(str,4); +#if DEBUG_DRAW + InitWindow(800, 600, "Hello, world!"); + while (!WindowShouldClose()) { + BeginDrawing(); + ClearBackground(RAYWHITE); + EndDrawing(); + } + CloseWindow(); +#endif + return 0; +} \ No newline at end of file diff --git a/tests/Main.ling b/tests/Main.ling new file mode 100644 index 0000000..85ba486 --- /dev/null +++ b/tests/Main.ling @@ -0,0 +1,23 @@ +import io; + +public struct ST { + + public i8 a; + motheronly i16 b; + external i32 c; + internal bool d; + + public fn void Log() { + Console.Log(a.ToString()); + } + +} + +public fn i32 Main() { + Console.Log("Hello World!"); + return 0; +} + +fn i32, i32 Out(i32 a, i32 b) { + return a, b; +} \ No newline at end of file