1 / 8

Group Project

Group Project. Justin Hust Ethan Petuchowski Simon Doty LISP Interpreter using JavaCC and jjTree SQL Subquery in ReL. Lisp Interpreter Overview. Created LISP interpreter by building an Abstract Syntax Tree that is visitable.

stuart
Download Presentation

Group Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.

More Related