-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (40 loc) · 1.34 KB
/
Copy pathProgram.cs
File metadata and controls
46 lines (40 loc) · 1.34 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
using System;
using Rook.Tree;
using System.IO;
using Rook.Parse;
using Rook.Tree.Env;
using Rook.Tokenizer;
using System.Collections.Generic;
namespace Rook
{
class Program
{
static void Main(string[] args)
{
string fileName = "tests/string-test.rk";
/* Lexer lexer = new Lexer(fileName);
Token next = lexer.Next();
while(next.Type != TokenType.EOF) {
Console.WriteLine(next);
next = lexer.Next();
} */
Parser parser = new Parser(fileName);
List<AST> trees = parser.Parse();
Tree.Env.Environment env = Tree.Env.Environment.Scope();
env.Set("Print", new Print(new List<string>(new string[]{"value"})));
env.Set("Read", new Read(new List<string>(new string[]{"prompt"})));
foreach(AST tree in trees) {
tree.Evaluate(env);
}
/* while(token.Type != TokenType.EOF) {
Console.WriteLine(token);
token = lexer.Next();
} */
/* string n = ".345";
double result;
Console.WriteLine(n);
double.TryParse(n, out result);
Console.WriteLine(result); */
}
}
}