Download presentation
Presentation is loading. Please wait.
Published byGlenna Pranoto Modified over 6 years ago
1
Group Project Justin Hust Ethan Petuchowski Simon Doty
LISP Interpreter using JavaCC and jjTree SQL Subquery in ReL
2
Lisp Interpreter Overview
Created LISP interpreter by building an Abstract Syntax Tree that is visitable. A different node type for each terminal, non- terminal gets hung on the AST. Uses three visitors – displayAST, build environment, interpret. Modes for static and dynamic scoping
3
AST Nodes ASTIdentifier x, y, f ASTNum 1000, 3.14 ASTArithExpr (+ 4 3)
ASTLambdaExpr (lambda (x) (+ x 3)) Function Application: ASTFunctionExpr ((lambda (y) (+ y y)) 5) ASTNamedFunctionApp (f 5)
4
AST Print Visitor Visitor for AST Printing
Displays abstract syntax for nodes
5
Interpret Visitor Interpret visitor visits each node and (eagerly) evaluates. Visitor takes scoping mode parameter. Preprocesses all lets to lambdas. Saves deferred substitutions as an ArrayList of TreeMaps ( e.g. x → 5 ; f → (lambda (y) y) )
6
Environment Visitor Builds environment with FAE-like syntax.
7
SQL Subquery in ReL Modified Python.g to recognize subselect inside of WHERE clause. Creates sqlsubquery node when it sees SELECT keyword. Modified SQLVisitor.java subSelect() method. Cleans up subselect statement, casts to jsqlparser Select statement, and adds to ArrayList of subselects. Calls getSelect( ) on main select statement and again on each subselect statement using a new instance of SQLVisitor
8
SQL Subquery in ReL (cont')
Now that ArrayList of subselects has elements, SQL to RDF conversion is different. If “subselects” list has elements, WHERE clause must operate on the result from the subquery. e.g. <select> WHERE TYPEID_PETS in <subselect>… WHERE clauses without subqueries are added to the “filters” list as before.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.