Created
February 14, 2015 11:50
-
-
Save tangentstorm/b9588b6c8ca557bbddee to your computer and use it in GitHub Desktop.
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
{$mode delphi} | |
unit uAST; // abstract syntax tree for simple interpreter | |
interface uses classes, sysutils, variants; | |
type | |
TSyntax = variant; | |
TExpr = variant; | |
TBoolExpr = variant; | |
TStmt = variant; | |
TIfStmt = variant; | |
TWhileStmt = variant; | |
TWriteStmt = variant; | |
TAssignStmt = variant; | |
function NewSyntax() : TSyntax; | |
function NewExpr() : TExpr; | |
function NewBoolExpr() : TBoolExpr; | |
function NewStmt() : TStmt; | |
function NewIfStmt(condition: TBoolExpr; thenPart: TStmt; elsePart: TStmt) : TIfStmt; | |
function NewWhileStmt(condition: TBoolExpr; body: TStmt) : TWhileStmt; | |
function NewWriteStmt() : TWriteStmt; | |
function NewAssignStmt() : TAssignStmt; | |
implementation | |
function NewSyntax() : TSyntax; | |
begin result := null end; | |
function NewExpr() : TExpr; | |
begin result := null end; | |
function NewBoolExpr() : TBoolExpr; | |
begin result := null end; | |
function NewStmt() : TStmt; | |
begin result := null end; | |
function NewIfStmt(condition: TBoolExpr; thenPart: TStmt; elsePart: TStmt) : TIfStmt; | |
begin result := null end; | |
function NewWhileStmt(condition: TBoolExpr; body: TStmt) : TWhileStmt; | |
begin result := null end; | |
function NewWriteStmt() : TWriteStmt; | |
begin result := null end; | |
function NewAssignStmt() : TAssignStmt; | |
begin result := null end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment