From a47c6403ac44c45b6c382fccdc4641c4c34f4abf Mon Sep 17 00:00:00 2001 From: Pyro569 Date: Sun, 5 Nov 2023 18:10:13 -0500 Subject: [PATCH 1/5] Update testfile.dl --- testfile.dl | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/testfile.dl b/testfile.dl index 0764508..fd9167a 100644 --- a/testfile.dl +++ b/testfile.dl @@ -1,22 +1,23 @@ #import dawnlang.io; +#import dawnlang.data.types; function main(){ - int num = 12; - switch(num){ - case 12: - print("Its 12!\n"); + bool TrueFalse = false; + switch(TrueFalse){ + case 0: + print("False!\n"); break; - case 13: - print("Its 13!\n"); + case 1: + print("True!\n"); break; } - num = 13; - switch(num){ - case 12: - print("Its 12!\n"); + TrueFalse = true; + switch(TrueFalse){ + case 0: + print("False!\n"); break; - case 13: - print("Its 13!\n"); + case 1: + print("True!\n"); break; } } \ No newline at end of file From 42895cd9be7aee15fa1958e4499c31bb6ba228a1 Mon Sep 17 00:00:00 2001 From: Pyro569 Date: Sun, 5 Nov 2023 18:14:31 -0500 Subject: [PATCH 2/5] Update Documentation --- example files/booleans.dl | 2 +- example files/comments.dl | 4 +++- testfile.dl | 20 ++------------------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/example files/booleans.dl b/example files/booleans.dl index 2f5eba4..3cf16fa 100644 --- a/example files/booleans.dl +++ b/example files/booleans.dl @@ -7,6 +7,6 @@ function main(){ //set the boolean value to true TrueFalse = true; - //to print if a boolean is true or false, print_int() should work, 0 = false, 1 = true + //to print if a boolean is true or false, print.int() should work, 0 = false, 1 = true print.int(TrueFalse); } \ No newline at end of file diff --git a/example files/comments.dl b/example files/comments.dl index c47d49e..3e5155f 100644 --- a/example files/comments.dl +++ b/example files/comments.dl @@ -1,4 +1,6 @@ +#import dawnlang.io; + function main(){ //to create a comment, make an empty line with a // at the beginning - //this file should do nothing! + print("There is a comment before this!\n"); } \ No newline at end of file diff --git a/testfile.dl b/testfile.dl index fd9167a..983321d 100644 --- a/testfile.dl +++ b/testfile.dl @@ -1,23 +1,7 @@ #import dawnlang.io; -#import dawnlang.data.types; function main(){ - bool TrueFalse = false; - switch(TrueFalse){ - case 0: - print("False!\n"); - break; - case 1: - print("True!\n"); - break; - } - TrueFalse = true; - switch(TrueFalse){ - case 0: - print("False!\n"); - break; - case 1: - print("True!\n"); - break; + for(int i = 1; i < 101; i++){ + print.int(i); } } \ No newline at end of file From 9bc03cbca63b18e55e4e46efb67ca87a655d1923 Mon Sep 17 00:00:00 2001 From: Pyro569 Date: Sun, 5 Nov 2023 18:22:43 -0500 Subject: [PATCH 3/5] Compiler Arg for Help --- ArgReader.cs | 14 ++++++++++++++ ErrorCodes.cs | 2 ++ 2 files changed, 16 insertions(+) diff --git a/ArgReader.cs b/ArgReader.cs index 955bda2..4e98cd3 100644 --- a/ArgReader.cs +++ b/ArgReader.cs @@ -4,6 +4,14 @@ namespace DawnLangCompiler { class ArgReader { + private static List PossibleArgs = new List(){ + "-d - Debug Mode (For development use only)", + "-b - Build File (input file name as next arg)", + "-br - Build and Run File (Compiles and then runs the compiled binary)", + "--version - Outputs the DawnLang version you have installed", + "--h - Prints out a list of possible arguments for the compiler", + "Example Compiler Usage: ./DawnLang \"-b\" \"hello_world.dl\" \"Hello_World\"" + }; public static void Main(string[] args) { for (int i = 0; i < args.Length; i++) @@ -18,6 +26,12 @@ public static void Main(string[] args) Tokenization.BuildFile(args[i + 1], args[i + 2]); Process.Start("./" + args[i + 2]);//is this platform independent? } + if (args[i] == "--version") + //TODO: Change this to DawnLang Version 1.0 for the full release + Console.WriteLine("DawnLang Version 1.0rc"); + if (args[i] == "--h") + for (int l = 0; l < PossibleArgs.Count; l++) + Console.WriteLine(PossibleArgs[l]); } } } diff --git a/ErrorCodes.cs b/ErrorCodes.cs index 2049a6b..5e50a6b 100644 --- a/ErrorCodes.cs +++ b/ErrorCodes.cs @@ -4,6 +4,7 @@ namespace DawnLangCompiler { class ErrorCodeIO { + //TODO: Finish this up in the 1.1 release public static void ErrorCodeOutput() { switch (Tokenization.ErrorOpCode) @@ -89,6 +90,7 @@ private static void cf200() //TODO: Engineer a good way to guess what the user was trying to type + File.Delete("Tokens.txt"); } } From 5078a5451e1a2ac192aeb87e4eb76d9422ca5c82 Mon Sep 17 00:00:00 2001 From: Pyro569 Date: Sun, 5 Nov 2023 18:41:54 -0500 Subject: [PATCH 4/5] Added dawnlang.io.args --- Tokenization.cs | 3 +++ testfile.dl | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Tokenization.cs b/Tokenization.cs index 13fc3a5..67d65e9 100644 --- a/Tokenization.cs +++ b/Tokenization.cs @@ -272,6 +272,9 @@ private static void ConvertTokens() case "dawnlang.data.types": ConvertedTokens[ConvertedTokens.Count - 1] += ""; break; + case "dawnlang.io.args": + ConvertedTokens[ConvertedTokens.Count - 1] += ""; + break; } break; case "List": diff --git a/testfile.dl b/testfile.dl index 983321d..aecd2bb 100644 --- a/testfile.dl +++ b/testfile.dl @@ -1,7 +1,8 @@ #import dawnlang.io; function main(){ - for(int i = 1; i < 101; i++){ - print.int(i); - } + //initialize variable called HelloWorld + string HelloWorld = "Hello, World!\n"; + //print string HelloWorld + print.str(HelloWorld); } \ No newline at end of file From 12c6d3f5a04bbc975e5dcefe64f18f7f9f05d648 Mon Sep 17 00:00:00 2001 From: Pyro569 Date: Sun, 5 Nov 2023 18:47:04 -0500 Subject: [PATCH 5/5] Updated command line args --- Tokenization.cs | 4 ++++ testfile.dl | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Tokenization.cs b/Tokenization.cs index 67d65e9..925c5ee 100644 --- a/Tokenization.cs +++ b/Tokenization.cs @@ -186,7 +186,11 @@ private static void ConvertTokens() { ConvertedTokens.Add("int main("); if (Tokens[i + 2] == "args") + { ConvertedTokens[ConvertedTokens.Count - 1] += "int argc, char** argv"; + IntVars.Add("argc"); + StringListNames.Add("argv"); + } ConvertedTokens[ConvertedTokens.Count - 1] += "){"; } else diff --git a/testfile.dl b/testfile.dl index aecd2bb..efcc821 100644 --- a/testfile.dl +++ b/testfile.dl @@ -1,8 +1,3 @@ -#import dawnlang.io; - function main(){ - //initialize variable called HelloWorld - string HelloWorld = "Hello, World!\n"; - //print string HelloWorld - print.str(HelloWorld); + } \ No newline at end of file