• entries
570
2427
• views
215659

# Untitled

60 views

Unforseen troubles.

So, I wrote that piece of #(%*)# #)(%*)( #*&% )#&%)# %)*#. It took all day, pain in the #)%**) but it appears to work. That is, it parses something like

(2+((3^2)*3))

Into a nice little tree which can be evaluated. But get this -

INPUT: 10^2-100+200/10^2
OUTPUT: = -2

See what's going on here? The actual output should be positive 2, not negative. For those of you who don't see it yet - lets examine the expanded output (first parse step) -

INPUT: 10^2-100+200/10^2
OUTPUT: ((10^2)-(100+(200/(10^2))))

See the bugger? the + operation is taking precidence over the - operation instead of being evaluated right-to-left with equal precidence. The culpret?
string pawn::equ::expand( string equ ) {	// ...	equ = expand( equ, "+" );	equ = expand( equ, "-" );	// ...	return equ;}

Yeah. Shit.

I never ever thought that I should be evaluating multiple symbols at the same time. Which is bad. Very very bad. Because, well, it doesn't work.

But the good news is that the expander works by searching to searching for the token string in something something, yadda yadda its one giant hack.

Oddly enough, two wrongs may not make a right, but too hacks certainly do make a solution:
string pawn::equ::expand( string equ ) {	// ...	equ = expand( equ, "+|-" );	// ...	return equ;}

Do I know why it works? No. In fact it shouldn't work at all. But it does so I'm not going to bother with it.

INFINITE IMPROBABILITY GOOO!!!!

y =<3.

THAT IS THE FORMULA FOR LOVE.

Use it wisely.

hmm.

INPUT: y=<3
OUTPUT: 3

3 = y = <3
3 = <3
1 = <

Intriguing.

## Create an account

Register a new account