Commit 2d4d5e50 authored by pm3g19's avatar pm3g19
Browse files

Added AST rules

parent 644e8fda
Prog : .in SetNames .out SetFuncCalls
SetNames : SetName
| SetName, SetNames
Prog : .in SetNames .out SetFuncCalls {($2, $4)}
SetNames : SetName {[$1]}
| SetNames, SetName
VarNames : VarName
| VarName, VarNames
| VarName',' VarNames
SetSetFuncCalls : SetFuncCall {[SetFuncCall]}
| SetFuncCall; SetFuncCalls {SetFuncCall:SetFuncCalls}
SetFuncCall : filter '['SetName']' (Func)
SetFuncCall : filter '['SetName']' '('Func')' {FuncCall (PredefFunc Filter) [$3] [$6]}
--filter[A](\r -> r[2] /= "")
Func : \'('VarNames')' -> Expr
\(r) -> r[1] == "hello"
Expr : Expr == Expr
| Expr'['Nat']'
| String
| VarName
| Record
| true
| false
Func : \'('VarNames')' -> Expr {FuncDef [] $3 $6}
--\(r) -> r[1] == "hello"
Expr : Expr == Expr {FuncCall (PredefFunc IsEqual) [] [$1, $3]}
| Expr'['Nat']' {FuncCall (PredefFunc RecordIndex) [] [$3]}
| String {String $1}
| VarName {Var $1}
| Record {$1}
| true {Boolean True}
| false {Boolean False}
Record : '['Exprs']' {Record $2}
Exprs : Expr {[$1]}
| Expr','Exprs {$1:$2}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment