Click here to Skip to main content
15,896,726 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dock an CControlBar into CChidFrame ? Pin
_Flaviu11-Dec-11 22:38
_Flaviu11-Dec-11 22:38 
GeneralRe: Dock an CControlBar into CChidFrame ? Pin
Richard MacCutchan12-Dec-11 0:35
mveRichard MacCutchan12-Dec-11 0:35 
GeneralRe: Dock an CControlBar into CChidFrame ? Pin
_Flaviu12-Dec-11 19:25
_Flaviu12-Dec-11 19:25 
Questionhow to parse an algebric equation in c++? Pin
rahulvishwakarma9-Dec-11 19:46
rahulvishwakarma9-Dec-11 19:46 
AnswerRe: how to parse an algebric equation in c++? Pin
Richard MacCutchan9-Dec-11 21:22
mveRichard MacCutchan9-Dec-11 21:22 
AnswerRe: how to parse an algebric equation in c++? Pin
Iain Clarke, Warrior Programmer9-Dec-11 23:08
Iain Clarke, Warrior Programmer9-Dec-11 23:08 
AnswerRe: how to parse an algebric equation in c++? Pin
Alan Balkany12-Dec-11 5:46
Alan Balkany12-Dec-11 5:46 
AnswerRe: how to parse an algebric equation in c++? Pin
Bram van Kampen12-Dec-11 16:00
Bram van Kampen12-Dec-11 16:00 
Hi,

Well, the End result depends very much on the lanuage definitions you assume, and, what you want to do with the end result.
You need to define Language Rules, for instance, where do f,x,y,a,b,c come from.
In 'C' the compiler builds a Symbol Table, which is a cross referenced database of all variables encountered in a module.
What do you want to do with it. If you want to store it as a 'General Formula, your best bet is probably to convert it to RPN (Reverse Polish Notation) and write an RPN Evaluator for when the rubber hits the road,

In general, I would start with writing a Scanner,the Scanner breaks down the text into Tokens

the 'C' rules are like: A Variable starts with 'A..Z','a..z' or '_'
A Variable name can then be followed with the same, and the chars '0..9'
A Numerical starts with '0..9'
A White Space is a ' '(space), '\t' or a '\n'

So , in the above, the name of the first var is 'f', the next char is a '(' which is not a
legal char for a varname. So, the First token is a Lexical Token, with Identifier 'f'
The Next Token would be a Special Token, LPAREN,
Going on in general, (Your Language Definition does not allow for comments),

I would also write a Parser
The Parser calls the scanner , to pick off tokens One by One, ignoring intervening whitespace, or comments, and creates a parsing tree (But it all still depends what you want to do with the expression in the larger scheme of things.

A Book: Writing Compilers & Interpreters (An Applied Approach) by Ronald Mak, ISBN 0-471-50968-X

Bram Smile | :)
Bram van Kampen

QuestionHow do i get the screen coordinates of an IHTMLElement? Pin
kartikdasani8-Dec-11 22:25
kartikdasani8-Dec-11 22:25 
AnswerRe: How do i get the screen coordinates of an IHTMLElement? Pin
Code-o-mat9-Dec-11 3:02
Code-o-mat9-Dec-11 3:02 
AnswerRe: How do i get the screen coordinates of an IHTMLElement? Pin
Skynet_Code11-Dec-11 4:43
Skynet_Code11-Dec-11 4:43 
Questionprint n in even numbers only Pin
Yolande MR8-Dec-11 10:15
Yolande MR8-Dec-11 10:15 
AnswerRe: print n in even numbers only Pin
Albert Holguin8-Dec-11 10:26
professionalAlbert Holguin8-Dec-11 10:26 
QuestionRe: print n in even numbers only Pin
David Crow8-Dec-11 10:52
David Crow8-Dec-11 10:52 
AnswerRe: print n in even numbers only Pin
Yolande MR8-Dec-11 11:36
Yolande MR8-Dec-11 11:36 
SuggestionRe: print n in even numbers only Pin
David Crow8-Dec-11 12:20
David Crow8-Dec-11 12:20 
GeneralRe: print n in even numbers only Pin
Albert Holguin8-Dec-11 13:06
professionalAlbert Holguin8-Dec-11 13:06 
GeneralRe: print n in even numbers only Pin
David Crow9-Dec-11 17:55
David Crow9-Dec-11 17:55 
GeneralRe: print n in even numbers only Pin
Chris Losinger8-Dec-11 13:44
professionalChris Losinger8-Dec-11 13:44 
GeneralRe: print n in even numbers only Pin
Yolande MR8-Dec-11 13:57
Yolande MR8-Dec-11 13:57 
GeneralRe: print n in even numbers only Pin
Albert Holguin9-Dec-11 4:10
professionalAlbert Holguin9-Dec-11 4:10 
GeneralRe: print n in even numbers only Pin
Albert Holguin10-Dec-11 7:54
professionalAlbert Holguin10-Dec-11 7:54 
GeneralRe: print n in even numbers only Pin
Richard MacCutchan10-Dec-11 22:11
mveRichard MacCutchan10-Dec-11 22:11 
GeneralRe: print n in even numbers only Pin
Addy Tas11-Dec-11 8:47
Addy Tas11-Dec-11 8:47 
AnswerRe: print n in even numbers only Pin
Richard MacCutchan8-Dec-11 22:16
mveRichard MacCutchan8-Dec-11 22:16 

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.