Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mathematical expression translator
#32
Hi Yetifoot,

Thank you for your contribution!
I can see you have done this before Big Grin

Regarding your questions:
The language/compiler/interpreter/translator  can be called anything as long as the syntax is close to qbasic so your code looks pretty fine to me.

The type of parsing is free to choose from so left-right or right-left, bottom-up, top-down all are fine, as long as the output is correct.

You have a good point regarding the float and integer division operators, the last one doesn't exists in C.
Example:
PRINT 11 - (4 * FIX(11 / 4))
PRINT 11 / 4
PRINT FIX(11 / 4)
PRINT 9 / 3
PRINT FIX(9 / 3)
PRINT 67 / -3
PRINT FIX(67 / -3)

Result Qbasic
3
2.75
2
3
3
-22.3333
-22

Result Visual Basic and C
3
2
2
3
3
-22
-22

Actually the result is not different in C but it doesn't show the correct output unless you explicit tell to output in float format.

I hope I explained things somewhat better now  :Smile

I didn't yet look very attentively to your code but so far it looks good, well done!

Cheers,
Frontrunner
Reply


Messages In This Thread
Re: Mathematical expression translator - by Ralph - 04-23-2008, 05:40 AM
Re: Mathematical expression translator - by Ralph - 04-23-2008, 11:09 PM
Re: Mathematical expression translator - by Ralph - 04-24-2008, 02:56 AM
Re: Mathematical expression translator - by Ralph - 04-24-2008, 07:51 AM
Re: Mathematical expression translator - by Ralph - 04-25-2008, 07:40 PM
Re: Mathematical expression translator - by Ralph - 04-26-2008, 12:40 AM
Re: Mathematical expression translator - by Ralph - 04-26-2008, 04:33 AM
Re: Mathematical expression translator - by Ralph - 04-29-2008, 08:30 AM
Re: Mathematical expression translator - by LPG - 04-29-2008, 10:57 AM
Re: Mathematical expression translator - by LPG - 04-30-2008, 09:06 AM
Re: Mathematical expression translator - by Frontrunner - 05-08-2008, 03:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)