Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-2008, 08:15 AM
mathmax mathmax is offline
Newbie
 
Join Date: Jun 2008
Posts: 2
Rep Power: 0
mathmax is on a distinguished road
Default parse an expression in c

Hello,

I would like to parse an expression which is a condition of the CA-Clipper language and then translate it into SQL. Do you think that tools like LEX and YACC could help me to solve my problem? Or do you think there is an other better way?

Here is a translation sample:

("Mart" $ Customers->Name .and. Orders->Price >= 120) .or. Oders->Date = ctod("18/06/08")

will be translated to:

where exists (select 0 from Customers as C, Orders as O where C.Id = O.Customers_Id and (C.Name like "%Mart%" and O.Price >= 120) or O.Date = #18/06/08#)

Thank you in advance,

Mathmax
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-22-2008, 09:04 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 793
Last Blog:
Programs Under the Hoo...
Rep Power: 13
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: parse an expression in c

Whoo, boy, have you got problems ahead of you. You're going to need to make a compiler/translator for this if you can't find anything on the Internet. I don't understand either language, but I can help with creating a basic parser. I did a quick Google search, and you might want to take a look at this:

clipper sql convert - Google Search
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-23-2008, 07:48 AM
mathmax mathmax is offline
Newbie
 
Join Date: Jun 2008
Posts: 2
Rep Power: 0
mathmax is on a distinguished road
Default Re: parse an expression in c

Thank you for your answer.

All the results returned by google are about how to convert .dbf file to SQL tables. This is unfortunately not my issue. I would like to create a Clipper expression parser in order to get a SQL where clause as result.
What do you think about using tools as lex and yacc to do this parser?

regards,

mathmax
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-24-2008, 09:29 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 793
Last Blog:
Programs Under the Hoo...
Rep Power: 13
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: parse an expression in c

I have no idea. Ask v0id or Jordan, they're very knowledgeable.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-25-2008, 01:15 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,421
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default Re: parse an expression in c

What you are looking at creating is basically a compiler, where it has to parse the Clipper language and translate it into the corresponding SQL. You may be able to do it with Regular Expressions, or with LEX & YACC (I'm not familiar with them). One thing that stands out is the fact that there are some definite assumptions that would have to be built into the process (such as the join fields).
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help with ereg expression orjan PHP Forum 7 04-08-2008 09:16 PM
Facial Expression Recognition Software Developed Kernel Programming News 2 02-27-2008 04:04 PM
Has anybody been using the MS Expression Web Design Program? george89 Website Design 1 07-16-2007 09:18 PM
can someone help me with my c librarys? bobwrit C and C++ 4 04-27-2007 07:19 PM
c# regular expression moonrise C# Programming 3 05-22-2006 05:54 PM


All times are GMT -5. The time now is 11:14 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 101%


Complete - Celebrate!

Ads