Download presentation
Presentation is loading. Please wait.
Published byTiffany Parrish Modified over 9 years ago
1
with SQL Michael Pace & Jerome Martinez
2
What is CoffeeScript? CoffeeScript is a language that compiles to JavaScript. Therefore, it can be used to interact with node.js, a server-side, out-of-browser JavaScript environment.
3
Project Overview We modified the CoffeeScript compiler to allow for local, embedded SQL commands. They cannot connect to an external database, but work as a local data store for your program running in a node.js environment.
4
SQL vs. CoffeeScript SQL SQL CREATE DATABASE database_name CREATE TABLE table_name (column_name1 data_type1, column_name2 data_type2) INSERT INTO table_name (column1, column2) VALUES (value1, value2) UPDATE table_name SET column1=value1 WHERE some_column=some_value DROP TABLE table_name SELECT column_name1,column_name2 FROM table_name1,table_name2 WHERE some_column=some_value CoffeeScript SQL CONNECT database_name CREATE TABLE table_name {column_name_1:data_type_1, column_name_2:data_type_2} INSERT INTO table_name VALUES {column1:value1, column2:value2} UPDATE table_name SET {column1:value1} WHERE some_column is some_value DROP TABLE table_name SELECT [column_name1,column_name2] FROM [table_name1,table_name2] WHERE some_column is some_value
5
Compiler Overview lexer.coffee – tokenizes code rewriter.coffee – transforms token stream grammar.coffee – generates Jison parser, creates AST nodes.coffee – translation to JavaScript
6
SQL Tokens Added lexer.coffee CONNECT CREATE_TABLE CREATE_DATABASE INSERT_INTO SELECT UPDATE WHERE
7
Changes to the Rewriter rewriter.coffee New method sqlRemoveCall()
8
Changes to the Grammar grammar.coffee Expression -> SQLExpression Assign -> Assignable = SqlExpression SQL grammar starts at line 300
9
SQL Node Added to AST nodes.coffee SQL node calls the JavaScript SQLite module New class SQLNode
10
simple.coffee
11
rec_fact.coffee
12
Installation Details for installing our source code is located in the readmereadme
13
Example Code Demo files in the demo/ directorydemo/
14
Future Projects Asynchronous database file access Connecting to remote servers Additional SQL commands
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.