-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: abstract synthax tree contracts definition
- Loading branch information
Houcine EL ADDALI
committed
Dec 3, 2023
1 parent
554fbb4
commit c85b6fe
Showing
2 changed files
with
33 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ast | ||
|
||
/* | ||
* Abstract syntax tree is the data structure | ||
* which our parser will return it's is an hierarchical DS | ||
* that represents 'the flow of the tokens' with a top down approach | ||
* It's called abstract because it doesn't include all elements such whitespace break lines .. | ||
*/ | ||
|
||
/* | ||
* The node type which be contained in the tree | ||
*/ | ||
type Node interface{ | ||
/* | ||
* The token literal representation in the node | ||
* This will be used only for testing and debugging purposes | ||
*/ | ||
TokenLiteral() string | ||
} | ||
|
||
/* | ||
* we wil be define for now 2 types of nodes | ||
* Statements nodes: doesn't return any value | ||
* Expression nodes : does return a value | ||
*/ | ||
type Statement interface { | ||
Node | ||
statementNode() | ||
} | ||
type Expression interface { | ||
Node | ||
expressionNode() | ||
} |
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