Skip to content

LuisFernandoBenatto/Simple-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Interpreter

license CSharp

Implementation: A simple expression interpreter


Create New Project in

Install .NET on Windows

Create the app:
  $ dotnet new console

Run the application:

  $ dotnet run

Example

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();
}  

Input

$x = 2 + 2 * 3;
$y = 1 + 10 / 2;
$z = $x + $y;
print($z);
$c = 942 + 371 * 46; 
print($c);
print(314);

Output

14
18008
314

Reference 🤩

Code used with reference: wellingtondellamura/compiler-from-scratch

About

Implementation: A simple expression interpreter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages