-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
62 lines (51 loc) · 2.95 KB
/
Copy pathProgram.cs
File metadata and controls
62 lines (51 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Diagnostics;
namespace PHPtoC_
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// Setup for optimization
// False = Dont delete the unused variables
// True = Delete unused variables
bool Optimization = true;
List<string> lexemes = new List<string>();
List<string> splittedCode = new List<string>();
Parser.Grammar grammar = new Parser.Grammar();
List<string> translated = new List<string>();
Stopwatch time = new Stopwatch();
time.Start();
{
Lexer lexer = new Lexer();
Parser parser = new Parser();
SemanticAnalyst semanticAnalyst = new SemanticAnalyst();
Translator translator = new Translator();
Console.WriteLine("\n------------------------------------------------------------------------------------\nLexer Result (PHP)\n------------------------------------------------------------------------------------");
lexer.OpenInputFiles("");
lexer.processingLine();
lexer.resultSplitter(lexemes, splittedCode);
Console.WriteLine("\n------------------------------------------------------------------------------------\nParser Result\n------------------------------------------------------------------------------------");
parser.parserStart(lexemes, splittedCode, grammar);
grammar.ShowGrammar();
Console.WriteLine("\nGrammar Length : " + grammar.GetGrammarLength());
Console.WriteLine("\nGrammar Amount : " + grammar.GetGrammarAmount());
Console.WriteLine("\n------------------------------------------------------------------------------------\nSemantic Analyst Result\n------------------------------------------------------------------------------------");
semanticAnalyst.Start(grammar, Optimization);
if(Optimization)
grammar.ShowGrammar();
Console.WriteLine("\n\n------------------------------------------------------------------------------------\nTranslator Result (Python)\n------------------------------------------------------------------------------------");
translator.TranslatorStart(grammar, translated);
translator.PrintTransator(translated);
}
time.Stop();
Console.WriteLine("\n\n------------------------------------------------------------------------------------");
Console.Write("Program runtime: {0}", time.Elapsed.TotalSeconds);
Console.Write(" seconds");
Console.WriteLine("\n------------------------------------------------------------------------------------");
}
}
}