PDA

View Full Version : sql compiler with qt



salahkimo
1st February 2016, 00:26
Hi. Im working now to create sql mini compiler. And i want to know
How to do the lexical analysis function to recognise my words
.what should i do ''PLCs''or i can just create a table contain
All my keywords to compare it with my qstring
Please help me .thank you all

jefftee
1st February 2016, 04:23
If you are going to parse anything other than a simple syntax structure, you should look at flex and bison...

d_stranz
1st February 2016, 22:10
I agree with jefftee. While you could certainly use a lookup table (QHash or QSet)to recognize the keywords in your SQL vocabulary, you will also need to recognize non-keywords like table and column identifiers, constants, wildcards, and so forth, and then create expression trees from all of it. This would be easier done using lex / yacc or flex / bison (or the C++ counterparts flex++ / bison++).

salahkimo
2nd February 2016, 09:05
I agree with jefftee. While you could certainly use a lookup table (QHash or QSet)to recognize the keywords in your SQL vocabulary, you will also need to recognize non-keywords like table and column identifiers, constants, wildcards, and so forth, and then create expression trees from all of it. This would be easier done using lex / yacc or flex / bison (or the C++ counterparts flex++ / bison++).

Thank you very much

wysota
2nd February 2016, 17:05
I agree with jefftee. While you could certainly use a lookup table (QHash or QSet)to recognize the keywords in your SQL vocabulary, you will also need to recognize non-keywords like table and column identifiers, constants, wildcards, and so forth, and then create expression trees from all of it. This would be easier done using lex / yacc or flex / bison (or the C++ counterparts flex++ / bison++).

If one is using Qt, qlalr is also an option.