Click here to Skip to main content
16,004,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralLoading a list from file into a List Box Pin
SmokingRope2214-Aug-00 14:53
SmokingRope2214-Aug-00 14:53 
GeneralRe: Loading a list from file into a List Box Pin
Philip Nicoletti15-Aug-00 3:24
Philip Nicoletti15-Aug-00 3:24 
GeneralRe: Loading a list from file into a List Box Pin
SmokingRope2215-Aug-00 17:06
SmokingRope2215-Aug-00 17:06 
GeneralMultiple doc templates problem Pin
Christian Graus14-Aug-00 9:20
protectorChristian Graus14-Aug-00 9:20 
GeneralRe: Multiple doc templates problem Pin
Mike Dunn14-Aug-00 20:40
Mike Dunn14-Aug-00 20:40 
GeneralRe: Check Visual C++ 4 HOW-TO Pin
Masaaki Onishi16-Aug-00 4:43
Masaaki Onishi16-Aug-00 4:43 
GeneralParsing a file Pin
mukesh.gupta@promap.co.uk14-Aug-00 4:23
mukesh.gupta@promap.co.uk14-Aug-00 4:23 
GeneralRe: Parsing a file Pin
Pete Bassett15-Aug-00 23:27
Pete Bassett15-Aug-00 23:27 
This is actually simpler than it would at first seem. You can use the stack based approach but I would go for a more stuctured implementation if I were you.

I have just finished a little project of implementing an interpreter for VB code. It doesn't cover the whole syntax but it does some cool stuff anyway.

I wrote the parsing code using BISON and FLEX. You may have heard of these before. FLEX is a lexical analyser generator and BISON is a parser generator. Both of these program generate valid C code which is ready to be incorporated into your program.

All you do is define the set of tokens used in the language to be parsed and then define a set of ways in which these tokens can be put together in the language. The ways in which the tokens can be used in the language are called the productions. E.g. for C++, the tokens would contain

" , ( ) void int long struct class { } =

And a production for the use of a built in type would be

BuiltInType : INT
| LONG
| DOUBLE
| FLOAT
| VOID
| etc etc etc;

This states that a Built in type is one of the tokens in the list. The "|" means OR. So a built in type is an int OR a aloat OR a void etc.

You can then define, in a BISON script, what C code is to get run when one complete production is found in the input buffer.

Because the script is written by you, you can have the output C code contain anything you want. In your case, when the "IveFoundAMethod" production is run you will want to save the relivant information about that method for use elsewhere in your program.

BISON and FLEX produce code that can be used in VC++. There are some very small changes to make to the generated code but they are only small and fairly self explanitory.

I know that you can find them for download if you search on Yahoo for "BISON FLEX".

Hope this helps
Generaldisable resize Pin
Guy13-Aug-00 14:19
Guy13-Aug-00 14:19 
GeneralRe: disable resize Pin
Remus Lazar14-Aug-00 3:16
Remus Lazar14-Aug-00 3:16 
GeneralRe: disable resize Pin
Guy14-Aug-00 8:30
Guy14-Aug-00 8:30 
GeneralRe: disable resize Pin
Mike Dunn14-Aug-00 7:34
Mike Dunn14-Aug-00 7:34 
Generalthank you Remus and Mike Pin
Guy15-Aug-00 5:08
Guy15-Aug-00 5:08 
GeneralGetting Mouse clicks Pin
Member 442613-Aug-00 7:02
Member 442613-Aug-00 7:02 
GeneralRe: Getting Mouse clicks Pin
Paolo Messina13-Aug-00 10:25
professionalPaolo Messina13-Aug-00 10:25 
GeneralReading TEXT files Pin
Steve Lai13-Aug-00 6:41
Steve Lai13-Aug-00 6:41 
GeneralRe: Reading TEXT files Pin
wanderley16-Aug-00 15:15
wanderley16-Aug-00 15:15 
GeneralI need .ICO and .ICL specs! Pin
Eto12-Aug-00 21:38
Eto12-Aug-00 21:38 
QuestionCan I add icons to the systray Pin
Leon Su12-Aug-00 15:50
sussLeon Su12-Aug-00 15:50 
Generaltoolbar within Splitter view Pin
Ivan Polak12-Aug-00 9:04
Ivan Polak12-Aug-00 9:04 
QuestionMultimedia real-time sound? Pin
mrcoder11-Aug-00 14:29
mrcoder11-Aug-00 14:29 
GeneralControl Panel..... Pin
Carlo Comino11-Aug-00 10:29
sussCarlo Comino11-Aug-00 10:29 
GeneralRe: Control Panel..... Pin
Mike Dunn11-Aug-00 18:59
Mike Dunn11-Aug-00 18:59 
GeneralOnAfterPrint for VC++ Pin
Derek Lakin11-Aug-00 5:39
Derek Lakin11-Aug-00 5:39 
GeneralString sorting Pin
Erik Hammar11-Aug-00 2:36
Erik Hammar11-Aug-00 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.