Skip to content

Commit ca6505a

Browse files
committed
Move around lots of stuff and fix examples
1 parent 9a18ddc commit ca6505a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+175
-280
lines changed

csynth.sln

+7-28
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B5047B1F-FC9
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.CLI", "src\CLI\CSynth.CLI.csproj", "{AA8D03D3-3A64-4CAC-AA01-EBAA4A19CEBA}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.AST", "src\AST\CSynth.AST.csproj", "{4C3F6E2A-28BB-40A5-9468-A9972D0597E1}"
11-
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Analysis", "src\Analysis\CSynth.Analysis.csproj", "{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F}"
13-
EndProject
1410
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Bench", "bench\CSynth.Bench.csproj", "{F41BE8D4-FCE1-48C0-B7C4-B474A2D27BAF}"
1511
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Transformation", "src\Transformation\CSynth.Transformation.csproj", "{298915EE-5928-4009-A556-48AC0D2DC336}"
17-
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Compiler", "src\Compiler\CSynth.Compiler.csproj", "{40C38A09-892F-4803-870D-454AA16DEFB2}"
19-
EndProject
2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{46BFDF8B-5198-41B7-A2D2-DF6BD06F1C78}"
2113
EndProject
2214
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Conformance", "tests\Conformance\CSynth.Conformance.csproj", "{0C0047E2-47E1-48E4-8109-521F6D71BD73}"
2315
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSynth.Core", "src\Core\CSynth.Core.csproj", "{22CB7650-885C-4073-9F59-E35FDB487E65}"
17+
EndProject
2418
Global
2519
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2620
Debug|Any CPU = Debug|Any CPU
@@ -31,41 +25,26 @@ Global
3125
{AA8D03D3-3A64-4CAC-AA01-EBAA4A19CEBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
3226
{AA8D03D3-3A64-4CAC-AA01-EBAA4A19CEBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
3327
{AA8D03D3-3A64-4CAC-AA01-EBAA4A19CEBA}.Release|Any CPU.Build.0 = Release|Any CPU
34-
{4C3F6E2A-28BB-40A5-9468-A9972D0597E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35-
{4C3F6E2A-28BB-40A5-9468-A9972D0597E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
36-
{4C3F6E2A-28BB-40A5-9468-A9972D0597E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
37-
{4C3F6E2A-28BB-40A5-9468-A9972D0597E1}.Release|Any CPU.Build.0 = Release|Any CPU
38-
{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39-
{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
40-
{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
41-
{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F}.Release|Any CPU.Build.0 = Release|Any CPU
4228
{F41BE8D4-FCE1-48C0-B7C4-B474A2D27BAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4329
{F41BE8D4-FCE1-48C0-B7C4-B474A2D27BAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
4430
{F41BE8D4-FCE1-48C0-B7C4-B474A2D27BAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
4531
{F41BE8D4-FCE1-48C0-B7C4-B474A2D27BAF}.Release|Any CPU.Build.0 = Release|Any CPU
46-
{298915EE-5928-4009-A556-48AC0D2DC336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47-
{298915EE-5928-4009-A556-48AC0D2DC336}.Debug|Any CPU.Build.0 = Debug|Any CPU
48-
{298915EE-5928-4009-A556-48AC0D2DC336}.Release|Any CPU.ActiveCfg = Release|Any CPU
49-
{298915EE-5928-4009-A556-48AC0D2DC336}.Release|Any CPU.Build.0 = Release|Any CPU
50-
{40C38A09-892F-4803-870D-454AA16DEFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51-
{40C38A09-892F-4803-870D-454AA16DEFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
52-
{40C38A09-892F-4803-870D-454AA16DEFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
53-
{40C38A09-892F-4803-870D-454AA16DEFB2}.Release|Any CPU.Build.0 = Release|Any CPU
5432
{0C0047E2-47E1-48E4-8109-521F6D71BD73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5533
{0C0047E2-47E1-48E4-8109-521F6D71BD73}.Debug|Any CPU.Build.0 = Debug|Any CPU
5634
{0C0047E2-47E1-48E4-8109-521F6D71BD73}.Release|Any CPU.ActiveCfg = Release|Any CPU
5735
{0C0047E2-47E1-48E4-8109-521F6D71BD73}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{22CB7650-885C-4073-9F59-E35FDB487E65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{22CB7650-885C-4073-9F59-E35FDB487E65}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{22CB7650-885C-4073-9F59-E35FDB487E65}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{22CB7650-885C-4073-9F59-E35FDB487E65}.Release|Any CPU.Build.0 = Release|Any CPU
5840
EndGlobalSection
5941
GlobalSection(SolutionProperties) = preSolution
6042
HideSolutionNode = FALSE
6143
EndGlobalSection
6244
GlobalSection(NestedProjects) = preSolution
6345
{AA8D03D3-3A64-4CAC-AA01-EBAA4A19CEBA} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
64-
{4C3F6E2A-28BB-40A5-9468-A9972D0597E1} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
65-
{C1E646A0-12DF-4A66-A9D0-0AF0F3AA2F4F} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
66-
{298915EE-5928-4009-A556-48AC0D2DC336} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
67-
{40C38A09-892F-4803-870D-454AA16DEFB2} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
6846
{0C0047E2-47E1-48E4-8109-521F6D71BD73} = {46BFDF8B-5198-41B7-A2D2-DF6BD06F1C78}
47+
{22CB7650-885C-4073-9F59-E35FDB487E65} = {B5047B1F-FC9D-4615-A20A-46CF9BC71355}
6948
EndGlobalSection
7049
GlobalSection(ExtensibilityGlobals) = postSolution
7150
SolutionGuid = {1B2101B2-D15B-48AA-940E-CF1F390BB75A}

examples/average/average.lua

+20-21
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,41 @@ local List1 = require("@System/Collections/Generic/List1")
66
Module = {}
77
Program = {}
88
function Program.Main_8272()
9-
local local_0, local_3, local_1, local_4, local_5, local_2
10-
local_0 = List1.new_8323580() -- System.Void System.Collections.Generic.List`1<System.Int32>::.ctor()
9+
local local_0, result_16, local_3, result_28, LoopControl, result_37, local_1, result_52, local_4, result_77, result_63, local_5, result_103, local_2
10+
local_0 = List1.new_8326360() -- System.Void System.Collections.Generic.List`1<System.Int32>::.ctor()
1111
Console.WriteLine_72296("Enter a number (or 'done' to finish): ") -- System.Void System.Console::WriteLine(System.String)
1212
repeat
1313
result_16 = Console.ReadLine_72080() -- System.String System.Console::ReadLine()
1414
local_3 = result_16
15-
result_28 = String.op_Equality_6861180(local_3, "done") -- System.Boolean System.String::op_Equality(System.String,System.String)
16-
if result_28 ~= 0 then
17-
LoopControl = 0
15+
result_28 = String.op_Equality_6863212(local_3, "done") -- System.Boolean System.String::op_Equality(System.String,System.String)
16+
if result_28 then
17+
LoopControl = 0x0
1818
else
19-
result_37 = Int32.Parse_7019272(local_3) -- System.Int32 System.Int32::Parse(System.String)
20-
List1.Add_8324160(local_0, result_37) -- System.Void System.Collections.Generic.List`1<System.Int32>::Add(!0)
21-
LoopControl = 1
19+
result_37 = Int32.Parse_7021304(local_3) -- System.Int32 System.Int32::Parse(System.String)
20+
List1.Add_8326940(local_0, result_37) -- System.Void System.Collections.Generic.List`1<System.Int32>::Add(!0)
21+
LoopControl = 0x1
2222
end
23-
until LoopControl == 0
24-
local_1 = 0
25-
result_52 = List1.GetEnumerator_8325788(local_0) -- System.Collections.Generic.List`1/Enumerator<!0> System.Collections.Generic.List`1<System.Int32>::GetEnumerator()
23+
until not (LoopControl ~= 0x0)
24+
local_1 = 0x0
25+
result_52 = List1.GetEnumerator_8328568(local_0) -- System.Collections.Generic.List`1/Enumerator<!0> System.Collections.Generic.List`1<System.Int32>::GetEnumerator()
2626
local_4 = result_52
2727
repeat
28-
result_77 = List1.Enumerator.MoveNext_8327844(local_4) -- System.Boolean System.Collections.Generic.List`1/Enumerator<System.Int32>::MoveNext()
29-
if result_77 ~= 0 then
30-
result_63 = List1.Enumerator.get_Current_8328000(local_4) -- !0 System.Collections.Generic.List`1/Enumerator<System.Int32>::get_Current()
28+
result_77 = List1.Enumerator.MoveNext_8330624(local_4) -- System.Boolean System.Collections.Generic.List`1/Enumerator<System.Int32>::MoveNext()
29+
if result_77 then
30+
result_63 = List1.Enumerator.get_Current_8330780(local_4) -- !0 System.Collections.Generic.List`1/Enumerator<System.Int32>::get_Current()
3131
local_5 = result_63
32-
local_1 = local_1 + local_5
33-
LoopControl = 1
32+
local_1 = bit32.bor(local_1 + local_5, 0x0)
33+
LoopControl = 0x1
3434
else
35-
LoopControl = 0
35+
LoopControl = 0x0
3636
end
37-
until LoopControl == 0
38-
result_103 = List1.get_Count_8323924(local_0) -- System.Int32 System.Collections.Generic.List`1<System.Int32>::get_Count()
37+
until not (LoopControl ~= 0x0)
38+
result_103 = List1.get_Count_8326704(local_0) -- System.Int32 System.Collections.Generic.List`1<System.Int32>::get_Count()
3939
local_2 = local_1 / result_103
4040
Console.WriteLine_72312("Average: {0}", local_2) -- System.Void System.Console::WriteLine(System.String,System.Object)
41-
return nil
4241
end
4342
function Program.new_8428(this)
44-
Object.new_6830880(this) -- System.Void System.Object::.ctor()
43+
Object.new_6832912(this) -- System.Void System.Object::.ctor()
4544
return nil
4645
end
4746
Program.Main_8272() -- System.Void Program::Main()

examples/boxing/boxing.lua

+10-12
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,29 @@ local Int32 = require("@System/Int32")
55
Module = {}
66
Program = {}
77
function Program.Main_8272()
8-
local local_0, local_1, local_2
9-
local_0 = 123
8+
local local_0, local_1, local_2, result_24, result_29, result_51, overflow_0, result_56, result_73, result_78
9+
local_0 = 0x7B
1010
local_1 = local_0
1111
local_2 = local_1
12-
result_24 = Int32.ToString_7019192(local_0) -- System.String System.Int32::ToString()
13-
result_29 = String.Concat_6865052("Value: ", result_24) -- System.String System.String::Concat(System.String,System.String)
12+
result_24 = Int32.ToString_7021224(local_0) -- System.String System.Int32::ToString()
13+
result_29 = String.Concat_6867084("Value: ", result_24) -- System.String System.String::Concat(System.String,System.String)
1414
Console.WriteLine_72296(result_29) -- System.Void System.Console::WriteLine(System.String)
1515
overflow_0 = nil
16-
if local_1 ~= 0 then
17-
result_51 = Object.ToString_6830888(local_1) -- System.String System.Object::ToString()
16+
if local_1 ~= nil then
17+
result_51 = Object.ToString_6832920(local_1) -- System.String System.Object::ToString()
1818
overflow_0 = result_51
19-
overflow_1 = "Boxed Value: "
2019
else
2120
overflow_0 = nil
22-
overflow_1 = "Boxed Value: "
2321
end
24-
result_56 = String.Concat_6865052("Boxed Value: ", overflow_0) -- System.String System.String::Concat(System.String,System.String)
22+
result_56 = String.Concat_6867084("Boxed Value: ", overflow_0) -- System.String System.String::Concat(System.String,System.String)
2523
Console.WriteLine_72296(result_56) -- System.Void System.Console::WriteLine(System.String)
26-
result_73 = Int32.ToString_7019192(local_2) -- System.String System.Int32::ToString()
27-
result_78 = String.Concat_6865052("Unboxed Value: ", result_73) -- System.String System.String::Concat(System.String,System.String)
24+
result_73 = Int32.ToString_7021224(local_2) -- System.String System.Int32::ToString()
25+
result_78 = String.Concat_6867084("Unboxed Value: ", result_73) -- System.String System.String::Concat(System.String,System.String)
2826
Console.WriteLine_72296(result_78) -- System.Void System.Console::WriteLine(System.String)
2927
return nil
3028
end
3129
function Program.new_8373(this)
32-
Object.new_6830880(this) -- System.Void System.Object::.ctor()
30+
Object.new_6832912(this) -- System.Void System.Object::.ctor()
3331
return nil
3432
end
3533
Program.Main_8272() -- System.Void Program::Main()

examples/fibonacci/Fibonacci.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Fibonacci
44
{
55
static void Main()
66
{
7-
int n = 50;
7+
int n = 25;
88
int[] fib = new int[n];
99
fib[0] = 0;
1010
fib[1] = 1;

examples/fibonacci/fibonacci.lua

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ local Console = require("@System/Console")
33
Module = {}
44
Fibonacci = {}
55
function Fibonacci.Main_8272()
6-
local local_0, local_1, local_2, local_3
7-
local_0 = 50
6+
local local_0, local_1, local_2, LoopControl, local_3
7+
local_0 = 0x19
88
local_1 = table.create(local_0)
9-
local_1[0] = 0
10-
local_1[1] = 1
11-
local_2 = 2
9+
local_1[0x0] = 0x0
10+
local_1[0x1] = 0x1
11+
local_2 = 0x2
1212
repeat
1313
if local_2 < local_0 then
14-
local_1[local_2] = local_1[local_2 - 1] + local_1[local_2 - 2]
15-
local_2 = local_2 + 1
16-
LoopControl = 1
14+
local_1[local_2] = bit32.bor(local_1[bit32.bor(local_2 - 0x1, 0x0)] + local_1[bit32.bor(local_2 - 0x2, 0x0)], 0x0)
15+
local_2 = bit32.bor(local_2 + 0x1, 0x0)
16+
LoopControl = 0x1
1717
else
18-
LoopControl = 0
18+
LoopControl = 0x0
1919
end
20-
until LoopControl == 0
21-
local_3 = 0
20+
until not (LoopControl ~= 0x0)
21+
local_3 = 0x0
2222
repeat
2323
if local_3 < local_0 then
2424
Console.WriteLine_72216(local_1[local_3]) -- System.Void System.Console::WriteLine(System.Int32)
25-
local_3 = local_3 + 1
26-
LoopControl = 1
25+
local_3 = bit32.bor(local_3 + 0x1, 0x0)
26+
LoopControl = 0x1
2727
else
28-
LoopControl = 0
28+
LoopControl = 0x0
2929
end
30-
until LoopControl == 0
30+
until not (LoopControl ~= 0x0)
3131
return nil
3232
end
3333
function Fibonacci.new_8349(this)
34-
Object.new_6830880(this) -- System.Void System.Object::.ctor()
34+
Object.new_6832912(this) -- System.Void System.Object::.ctor()
3535
return nil
3636
end
3737
Fibonacci.Main_8272() -- System.Void Fibonacci::Main()

examples/fibonacci/output.txt

+1-26
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,4 @@
2222
10946
2323
17711
2424
28657
25-
46368
26-
75025
27-
121393
28-
196418
29-
317811
30-
514229
31-
832040
32-
1346269
33-
2178309
34-
3524578
35-
5702887
36-
9227465
37-
14930352
38-
24157817
39-
39088169
40-
63245986
41-
102334155
42-
165580141
43-
267914296
44-
433494437
45-
701408733
46-
1134903170
47-
1836311903
48-
2971215073
49-
4807526976
50-
7778742049
25+
46368

examples/fizzbuzz/fizzbuzz.lua

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ local Console = require("@System/Console")
33
Module = {}
44
FizzBuzz = {}
55
function FizzBuzz.Main_8272()
6-
local local_0
7-
local_0 = 1
6+
local local_0, LoopControl
7+
local_0 = 0x1
88
repeat
9-
if local_0 <= 100 then
10-
if local_0 % 15 ~= 0 then
11-
if local_0 % 3 ~= 0 then
12-
if local_0 % 5 ~= 0 then
9+
if local_0 <= 0x64 then
10+
if local_0 % 0xF ~= 0x0 then
11+
if local_0 % 0x3 ~= 0x0 then
12+
if local_0 % 0x5 ~= 0x0 then
1313
Console.WriteLine_72216(local_0) -- System.Void System.Console::WriteLine(System.Int32)
1414
else
1515
Console.WriteLine_72296("Buzz") -- System.Void System.Console::WriteLine(System.String)
@@ -20,16 +20,16 @@ function FizzBuzz.Main_8272()
2020
else
2121
Console.WriteLine_72296("FizzBuzz") -- System.Void System.Console::WriteLine(System.String)
2222
end
23-
local_0 = local_0 + 1
24-
LoopControl = 1
23+
local_0 = bit32.bor(local_0 + 0x1, 0x0)
24+
LoopControl = 0x1
2525
else
26-
LoopControl = 0
26+
LoopControl = 0x0
2727
end
28-
until LoopControl == 0
28+
until not (LoopControl ~= 0x0)
2929
return nil
3030
end
3131
function FizzBuzz.new_8356(this)
32-
Object.new_6830880(this) -- System.Void System.Object::.ctor()
32+
Object.new_6832912(this) -- System.Void System.Object::.ctor()
3333
return nil
3434
end
3535
FizzBuzz.Main_8272() -- System.Void FizzBuzz::Main()

examples/multtable/multtable.lua

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
1+
local rt = require("@lib/Runtime")
12
local Object = require("@System/Object")
23
local Console = require("@System/Console")
34
Module = {}
45
MultiplicationTable = {}
56
function MultiplicationTable.PrintTable_8272(num)
6-
local local_0, local_1
7-
local_0 = 1
7+
local local_0, local_1, LoopControl
8+
local_0 = 0x1
89
repeat
9-
if local_0 <= 50 then
10-
local_1 = num * local_0
10+
if local_0 <= 0x32 then
11+
local_1 = rt.mul_Int32(num, local_0) -- mul_Int32
1112
Console.WriteLine_72344("{0} * {1} = {2}", num, local_0, local_1) -- System.Void System.Console::WriteLine(System.String,System.Object,System.Object,System.Object)
12-
local_0 = local_0 + 1
13-
LoopControl = 1
13+
local_0 = bit32.bor(local_0 + 0x1, 0x0)
14+
LoopControl = 0x1
1415
else
15-
LoopControl = 0
16+
LoopControl = 0x0
1617
end
17-
until LoopControl == 0
18+
until not (LoopControl ~= 0x0)
1819
return nil
1920
end
2021
function MultiplicationTable.Main_8332()
21-
local local_0, local_1, local_2
22-
temp_0 = table.create(6)
23-
temp_0[0] = 2
24-
temp_0[1] = 3
25-
temp_0[2] = 5
26-
temp_0[3] = 7
27-
temp_0[4] = 11
28-
temp_0[5] = 13
22+
local temp_0, local_0, local_1, local_2, LoopControl
23+
temp_0 = table.create(0x6)
24+
temp_0[0x0] = 0x2
25+
temp_0[0x1] = 0x3
26+
temp_0[0x2] = 0x5
27+
temp_0[0x3] = 0x7
28+
temp_0[0x4] = 0xB
29+
temp_0[0x5] = 0xD
2930
local_0 = temp_0
30-
local_1 = 0
31+
local_1 = 0x0
3132
repeat
3233
if local_1 < #(local_0) + 1 then
3334
local_2 = local_0[local_1]
3435
Console.WriteLine_72312("Multiplication table for {0}:", local_2) -- System.Void System.Console::WriteLine(System.String,System.Object)
3536
MultiplicationTable.PrintTable_8272(local_2) -- System.Void MultiplicationTable::PrintTable(System.Int32)
3637
Console.WriteLine_72092() -- System.Void System.Console::WriteLine()
37-
local_1 = local_1 + 1
38-
LoopControl = 1
38+
local_1 = bit32.bor(local_1 + 0x1, 0x0)
39+
LoopControl = 0x1
3940
else
40-
LoopControl = 0
41+
LoopControl = 0x0
4142
end
42-
until LoopControl == 0
43+
until not (LoopControl ~= 0x0)
4344
return nil
4445
end
4546
function MultiplicationTable.new_8423(this)
46-
Object.new_6830880(this) -- System.Void System.Object::.ctor()
47+
Object.new_6832912(this) -- System.Void System.Object::.ctor()
4748
return nil
4849
end
4950
MultiplicationTable.Main_8332() -- System.Void MultiplicationTable::Main()

0 commit comments

Comments
 (0)