Niniejszy projekt to transpilator nakładki na C dodającą obsługę SQL'a.
- Mateusz Woźniak (wozniakmat@student.agh.edu.pl)
- Jakub Błażowski (jblazowski@student.agh.edu.pl)
#include <stdio.h>
#include <sqlite3.h>
#include <stddef.h>
int main()
{
sqlInit;
int i, sum = 0;
INSERT INTO comments (comment) VALUES ("Hello World");
SELECT comment FROM comments INTO ownCallback;
UPDATE comments SET comment = "New comment" WHERE comment = "Hello World";
return 0;
}
git clone https://github.com/matisiekpl/compiler.git
cd compiler
pip install -r requirements.txt
python window.py # Uruchamia okno kompilatora
# Proszę ztranspilowany kod zapisać do pliku output.c
gcc output.c -o demo -l sqlite3
./demo
- Niedziałający kod (
Syntax error at line 8:4 - no viable alternative at input 'sqlInitreturn'
)
#include <stdio.h>
#include <sqlite3.h>
#include <stddef.h>
int main()
{
sqlInit
return 0;
}
- Niedziałający kod (
Syntax error at line 9:4 - mismatched input 'return' expecting ' FROM '
)
#include <stdio.h>
#include <sqlite3.h>
#include <stddef.h>
int main()
{
sqlInit;
SELECT a,b
return 0;
}
- Niedziałający kod (
Syntax error at line 0:0 - There is no sqlInit;
)
#include <stdio.h>
#include <sqlite3.h>
#include <stddef.h>
int main()
{
SELECT a,b
return 0;
}
- Działający kod
#include <stdio.h>
#include <sqlite3.h>
#include <stddef.h>
int main()
{
sqlInit;
int i, sum = 0;
INSERT INTO comments (comment) VALUES ("Hello World");
SELECT comment FROM comments INTO ownCallback;
UPDATE comments SET comment = "New comment" WHERE comment = "Hello World";
return 0;
}