File tree Expand file tree Collapse file tree 3 files changed +94
-0
lines changed
Expand file tree Collapse file tree 3 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace OwnLang . ast . lib
8+ {
9+ public class LambdaExpression : Expression
10+ {
11+ public Statement statement ;
12+
13+ public LambdaExpression ( Statement statement )
14+ {
15+ this . statement = statement ;
16+ }
17+
18+ public Value eval ( )
19+ {
20+ return new StatementValue ( statement ) ;
21+ }
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace OwnLang . ast . lib
8+ {
9+ public class StatementStatement : Statement
10+ {
11+ private Statement body ;
12+
13+ public StatementStatement ( Statement body )
14+ {
15+ this . body = body ;
16+ }
17+
18+ void Statement . execute ( )
19+ {
20+ body . execute ( ) ;
21+ }
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace OwnLang . ast . lib
8+ {
9+ public class StatementValue : Value
10+ {
11+ private Statement value ;
12+
13+ public StatementValue ( Statement value )
14+ {
15+ this . value = value ;
16+ }
17+
18+ public Statement asStatement ( )
19+ {
20+ return value ;
21+ }
22+
23+ public char asChar ( )
24+ {
25+ throw new NotImplementedException ( ) ;
26+ }
27+
28+ public double asDouble ( )
29+ {
30+ throw new NotImplementedException ( ) ;
31+ }
32+
33+ public int asNumber ( )
34+ {
35+ throw new NotImplementedException ( ) ;
36+ }
37+
38+ public string asString ( )
39+ {
40+ throw new NotImplementedException ( ) ;
41+ }
42+
43+ public TokenType type ( )
44+ {
45+ return TokenType . LAMBDA ;
46+ }
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments