Implementation: A simple expression interpreter
Install .NET on Windows
$ dotnet new console
Run the application:
$ dotnet run
static void Main(string[] args)
{
Lexer lexer = new Lexer("$x = 2 + 2 * 3; "
+ "$y = 1 + 10 / 2; "
+ "$z = $x + $y; "
+ "print($z);");
Parser parser = new Parser(lexer);
parser.Prog();
}
$x = 2 + 2 * 3;
$y = 1 + 10 / 2;
$z = $x + $y;
print($z);
$c = 942 + 371 * 46;
print($c);
print(314);
14
18008
314
Code used with reference: wellingtondellamura/compiler-from-scratch