Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello My Friends
I've tried a lot and I'm the program prioritize your operator to write in Assembly. Please anyone can you help friends and is an example for a program that introduced me to prioritize the operator specifies, for example, a computational expression as input and outputs based on get prioritized based on returns.

input :
(2+3)/2*3;
Posted
Comments
CPallini 4-Jun-13 9:08am    
What are you trying to do? Are your trying to translate expressions into assembly instructions?
Sergey Alexandrovich Kryukov 5-Jun-13 19:03pm    
Hard to say. Did you see my answer? However, my guess could be incorrect. You make a good point: it's OP's responsibility to ask a question more accurately.
—SA

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-Jun-13 19:01pm    
Why C++, if the question was about assembly language?
However, in practice, C++ rules will be still applicable in most cases, but at least you should have explained the idea...
—SA
Richard MacCutchan 6-Jun-13 3:03am    
See the question.
Sergey Alexandrovich Kryukov 6-Jun-13 7:47am    
If you saw the discussion in comments to the question: it's not quite clear to me...
—SA
Richard MacCutchan 6-Jun-13 7:52am    
Nor is it to me. But it 'appears' that OP wants to know what rules of operator precedence to adopt, in order to get the correct results for a mathematical expression. Hence, the link I provided may be what he/she needs to look at. You may find that your interpretation of questions like this is not always the correct one.
Sergey Alexandrovich Kryukov 6-Jun-13 9:46am    
That's the whole point. I'm really not sure, in this and some other cases. You are right, of course.
In this case, I'm just curious why C++, not anything else? It's assembly language, something not standardized. I think I made a correct point: it depends on particular compiler (Assembler), but most likely matches the most typical rule sets, in practice.
—SA
Assembly language itself does not have operators. And it is not like other languages, as it is not one single language applicable to all processors. The program is composed of processor instructions. No priority is needed, because instructions have exact meaning described, in particular, in processor documentation, and the order of execution (in a single thread/fiber, of course) is defined by order of those instructions. There is no and cannot be any ambiguity.

As to the expression example you've shown in your question, this is not actually a part of the code. You can use some compile-time expression (it totally depends on the version of the Assembly compiler and not related to the processor). The compiler computes such statically known values and use it in the production of compilation as they were the immediate constants at the point where you use them. I don't think the priority of operator can be too complex or much different from any high-level computer language.

—SA
 
Share this answer
 
v2
Comments
CPallini 6-Jun-13 1:48am    
Very good, my 5.
Sergey Alexandrovich Kryukov 6-Jun-13 1:59am    
Thank you, Carlo. Finally someone who does understand what I'm talking about came to this page.
Aren't most of people capable of writing in Assembly Language dies out? Hopefully, not all of us... :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900