-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Silverfly.Nodes; | ||
|
||
namespace Sample.FuncLanguage.Nodes; | ||
|
||
public record ImportNode(string Path) : AstNode; |
21 changes: 21 additions & 0 deletions
21
Source/Samples/Sample.FuncLanguage/Parselets/ImportParselet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Sample.FuncLanguage.Nodes; | ||
using Silverfly; | ||
using Silverfly.Nodes; | ||
using Silverfly.Parselets; | ||
|
||
namespace Sample.FuncLanguage.Parselets; | ||
|
||
public class ImportParselet : IPrefixParselet | ||
{ | ||
public AstNode Parse(Parser parser, Token token) | ||
{ | ||
var arg = parser.ParseExpression(); | ||
|
||
if (arg is LiteralNode { Value: string path }) | ||
{ | ||
return new ImportNode(path); | ||
} | ||
|
||
return new InvalidNode(token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[-] implement lambda functions as values | ||
lambdas with more than one parameter has to be implemented | ||
[ ] implement module definition | ||
[-] implement module import from file (read file, parse and evaluate with the current rootscope) | ||
[ ] implement to scope to import clr classes/functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let add x y = x + y |