diff --git a/.gitignore b/.gitignore index 5400d87..d56802f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ project-scripts/ testrun.sh testrundebug.sh build.sh -Main.cpp \ No newline at end of file +Main.cpp +Main.c \ No newline at end of file diff --git a/New-Compiler/ArgReader.dl b/New-Compiler/ArgReader.dl index 74b50b6..b9c39cd 100644 --- a/New-Compiler/ArgReader.dl +++ b/New-Compiler/ArgReader.dl @@ -1,8 +1,7 @@ +#include Tokenization.dl; #import dawnlang.io; #import dawnlang.io.args; -#include Tokenization.dl; - function main(args){ C-Code[ for(int i = 1; i < argc; i++){ diff --git a/New-Compiler/DawnLang b/New-Compiler/DawnLang index 66b2b0f..9b1e748 100755 Binary files a/New-Compiler/DawnLang and b/New-Compiler/DawnLang differ diff --git a/New-Compiler/Tokenization.dl b/New-Compiler/Tokenization.dl index 4cfb2ac..e69de29 100644 --- a/New-Compiler/Tokenization.dl +++ b/New-Compiler/Tokenization.dl @@ -1,5 +0,0 @@ -#import dawnlang.io; - -function ReadFile(string FilePath){ - -} \ No newline at end of file diff --git a/Old-Compiler/Creation.cs b/Old-Compiler/Creation.cs index 17ba351..f5a381a 100644 --- a/Old-Compiler/Creation.cs +++ b/Old-Compiler/Creation.cs @@ -8,7 +8,7 @@ public static void CreateCFile(string FileName) { Tokenization.ErrorOpCode = "wc100"; //wc for writing c, 100 for first potential error spot - StreamWriter outputFile = new StreamWriter(FileName + ".cpp"); + StreamWriter outputFile = new StreamWriter(FileName + ".c"); //write each converted token to the c file foreach (string codeLines in Tokenization.ConvertedTokens) @@ -25,7 +25,7 @@ public static void CompileCFile(string FileName, string OutputFileName) Tokenization.ErrorOpCode = "cf200"; //cf for compile file, 200 for second potential error spot - Process.Start("gcc", FileName + ".cpp -w -lstdc++"); //-lstdc++ every time in case if c++ code sections are included + Process.Start("gcc", FileName + ".c -w -lstdc++"); //-lstdc++ every time in case if c++ code sections are included Thread.Sleep(1500); //small micro sleep for program to not error moving file since it is so new File.Move("./a.out", "./" + OutputFileName); } @@ -34,8 +34,8 @@ public static void Cleanup(string FileName) { Tokenization.ErrorOpCode = "cl100"; //cl for cleanup, 100 for first potential error spot - if (File.Exists("./" + FileName + ".cpp")) //delete the TempFile.c if it still exists (which it still should, if not, error) - File.Delete("./" + FileName + ".cpp"); + if (File.Exists("./" + FileName + ".c")) //delete the TempFile.c if it still exists (which it still should, if not, error) + File.Delete("./" + FileName + ".c"); else System.Environment.Exit(1); } diff --git a/Old-Compiler/Tokenization.cs b/Old-Compiler/Tokenization.cs index 005710f..fb9ca2b 100644 --- a/Old-Compiler/Tokenization.cs +++ b/Old-Compiler/Tokenization.cs @@ -292,7 +292,7 @@ private static void ConvertTokens() switch (Tokens[i + 1]) { case "dawnlang.io": - ConvertedTokens[ConvertedTokens.Count - 1] += "\n#include "; + ConvertedTokens[ConvertedTokens.Count - 1] += ""; break; case "dawnlang.data.types": ConvertedTokens[ConvertedTokens.Count - 1] += ""; diff --git a/Old-Compiler/testfile.dl b/Old-Compiler/testfile.dl index 35b2998..135d933 100644 --- a/Old-Compiler/testfile.dl +++ b/Old-Compiler/testfile.dl @@ -1,7 +1,7 @@ -#import dawnlang.io; +#include print_number_function.dl; -function main(args){ - List intList = [12, 9, 7, 18]; - list.element.add(intList, 47); - print.list.element(intList, 4); +function main(){ + int twelve = 12; + //call the print_number function from the print_number_function.dl file + print_number(twelve); } \ No newline at end of file