Daily update on 20250328-131548 by Nitload Youmu. Additional Message : IF branch can be full functionally compiled. Next will be CASE_OF branch

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-03-28 13:15:48 +08:00
parent 36b6ad5a52
commit 17a226c206
18 changed files with 1069 additions and 74 deletions
+19 -5
View File
@@ -54,6 +54,8 @@ namespace StgSharp
"c", new ExpIntNode( new Token( "c", 0, 0, TokenFlag.Number ), 1, false ) );
LocalVariables.Add(
"d", new ExpIntNode( new Token( "d", 0, 0, TokenFlag.Number ), 1, false ) );
LocalVariables.Add(
"e", new ExpIntNode( new Token( "e", 0, 0, TokenFlag.Number ), 1, false ) );
}
}
@@ -119,21 +121,33 @@ namespace StgSharp
internal static partial class Program
{
private const string code = """
a := ( b * E + d * 2 ) * d;
(**)
a := b + (c + d) - a;
IF a = b THEN
a := a * e;
ELSE
a := c * e;
END_IF
(**)
""";
public static void ExpLinearExpressionTest()
{
ExpressCompile.InitCompile();
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter( "END", 0 );
//Console.WriteLine( @$"a := ( b * E + d * 2 ) * d;" );
transmitter.WriteLine( @$"a := ( b * E + d * 2 ) * d;" );
transmitter.WriteLine( @"a := b + (c + d) * a;" );
foreach( string line in code.Split(
Environment.NewLine, StringSplitOptions.RemoveEmptyEntries ) ) {
transmitter.WriteLine( line );
}
transmitter.EndWriting();
ExpSourceReader reader = new ExpSourceReader( transmitter );
/**/
ExpTestFuncSource func = new ExpTestFuncSource( "test", transmitter );
TestSchema testSchema = new TestSchema( func );
ExpNodeGenerator generator = new ExpNodeGenerator( testSchema, func );
ExpSyntaxAnalyzer generator = new ExpSyntaxAnalyzer( testSchema, func );
/**/
while( reader.TryReadToken( out Token t ) )