Skip to content

Commit

Permalink
Initialize Repo
Browse files Browse the repository at this point in the history
Finished the tokenizer, will now move on to making the AST. Currently supports most operations. GNU GPL v3.
  • Loading branch information
RdStudios9145 committed Oct 12, 2024
0 parents commit 9193472
Show file tree
Hide file tree
Showing 11 changed files with 3,777 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
BasedOnStyle: LLVM
UseTab: Always
TabWidth: 4
IndentWidth: 4

BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: true
IndentCaseLabels: false
IndentPPDirectives: BeforeHash
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
EmptyLineBeforeAccessModifier: Always
SeparateDefinitionBlocks: Always
SpaceBeforeInheritanceColon: true
BreakInheritanceList: BeforeColon
IndentAccessModifiers: False
AccessModifierOffset: -4
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.idea
*.log
tmp/

obj/
bin/
*.make
Makefile
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# FoxLang Compiler

LLVM moment

thats gonna be fun

Anyway this uses premake. just run `premake5 [build env, such as gmake2 for makefiles]` after installing premake5.

## We are at the cutting edge of compiler technology

just look at this code (Also it would be cool if there was a gh style for FoxLang)

``` fox
if (true) {
🦊println("Hello World!")
}
```

there will never be any indentation arguments again!

Also if i ever make a formatter, there will be only one idomatic style.
38 changes: 38 additions & 0 deletions premake/actions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function getOS()
-- ask LuaJIT first
if jit then
return jit.os
end

-- Unix, Linux variants
local fh,err = assert(io.popen("uname -o 2>/dev/null","r"))
if fh then
osname = fh:read()
end

return osname or "Windows"
end

newaction {
trigger = "format",
description = "Formats all code files to comply with formatting spec",
execute = function()
-- print(os.execute("pwd"))
local seperator = package.config:sub(1,1);
-- print("String" .. "Concat")
-- print(debug.getinfo(1).source)
local currentluasourcefile = debug.getinfo(1).source;
local pwd = currentluasourcefile:sub(2, string.len(currentluasourcefile) - 20);
print(pwd)
local src = io.popen([[pwd .. "/src"]]):lines();
print(src)
for dir in io.popen(pwd .. "/src"):lines() do print(dir) end;
print(getOS())
print(getOS():contains("Linux"))
package.path = package.path .. ";" .. pwd .. seperator .. "premake" .. seperator .. "?.lua"
.. ";" .. pwd .. seperator .. "premake" .. seperator .. "?" .. seperator .. "init.lua";
print(package.path)
local dir = require "pl.dir"
print(dir.getallfiles())
end
}
34 changes: 34 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
workspace "FoxLang"
architecture "x86_64"
configurations { "Debug", "", "Release" }

project "FoxLang"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
targetdir "bin/%{cfg.system}-%{cfg.buildcfg}-%{cfg.architecture}"

files {
"src/**.hpp",
"src/**.h",
"src/**.cpp",
"vendor/*/**.hpp",
"vendor/*/**.h"
}

includedirs {
"src",
"vendor/*"
}

filter "configurations:Debug"
defines { "FOX_DEBUG" }
symbols "On"
warnings "Extra"

filter "configurations:Release"
defines { "FOX_RELEASE" }
optimize "On"
warnings "Default"

include "premake/actions.lua"
Loading

0 comments on commit 9193472

Please sign in to comment.