From ef9ad459e9e12c85157089544550a4d1252d8507 Mon Sep 17 00:00:00 2001 From: Sai Nishanth Vaka Date: Wed, 20 Apr 2022 19:16:13 -0700 Subject: [PATCH] Intialised parser file, Added sample boolean, Numercis, Assignment, Fumction parser information --- src/parser_eval.pl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/parser_eval.pl diff --git a/src/parser_eval.pl b/src/parser_eval.pl new file mode 100644 index 0000000..097ed50 --- /dev/null +++ b/src/parser_eval.pl @@ -0,0 +1,36 @@ +% Language: Codeable +% Authors: Jacob H, Jacob J, Joseph H, Rithvik A, Sai Nishanth V. +% Version: 0.5.20220423 + + +% Main Parser +codeable(t_codeable(X)). + +% Parser - Numercis +number(t_number(N)) --> [N], {number(N)}. + +% Parser - Booleans +% boolean +boolean(t_bool_true) --> [true]. +boolean(t_bool_false) --> [false]. + +% Boolean comparission +bool_expr(t_is_equal_to(X,Y)) --> expression(X), [is-equal-to], expression(Y). + + +% Parser - Assignment +expression(t_assign_exprmult(X,Y)) --> id(X), [equals], expression(Y). +expression(X) --> expr(X). + +% Parser - Functions + +functions(t_functions(A,X,Y)) --> [begin], decl(X), [;], comm(Y), [end]. + +% Functions eval + +function_eval(Id, Args, [(Id,t_codeable_functions(Pt))|_],Value). +function_eval(Id, Aegs, [_|T],Value) :- function_eval(Id, T, Value). + + +% Main evaluator +codeable_evaluator(t_codeable(Pt), R). \ No newline at end of file -- knotmirror 0.0.1