Thread: Resolve Arithmetic operations

  1. #1
    Registered User
    Join Date
    Aug 2004

    Resolve Arithmetic operations

    Hello, I am working on a Compiler and I've made it to the point it has to resolve arithmetic operations, however I would like to save some time and implementing some sort of already existing algorithm, I would like to ask if anyone knows an internet place or a book or has the link to somewher shere it is already done, please, this is to save time, so if anyone could tell me I would be thankful really.

    when I finish it, I can upload my code so some other people could see how it was done

    OK, Thanks in advance (i've already googled "postix notation resolve mathematic operations" but I found nothing)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Quote Originally Posted by louis_mine
    OK, Thanks in advance (i've already googled "postix notation resolve mathematic operations" but I found nothing)
    Try postfix instead. You could of course just go find the source code to another compiler and look at that.

    Hope is the first step on the road to disappointment.

  3. #3
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Still in the egg
    Maybe digging into EBNF and getting the logic may help you to solve the problems. BNF( and also EBNF) is one of the basic parts of compiler desing.

  4. #4
    Registered User
    Join Date
    Mar 2006

    There is also a section on the shunting yard algorithm, a simple method to convert traditional ("infix") mathematical expressions to postfix notation.
    #include <stdio.h>
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. arithmetic operations
    By XodoX in forum C++ Programming
    Replies: 6
    Last Post: 06-29-2009, 12:28 AM
  2. doing floating operations using integer operations
    By ammalik in forum C Programming
    Replies: 10
    Last Post: 08-15-2006, 04:30 AM
  3. Matrix and vector operations on computers
    By DavidP in forum A Brief History of
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM
  4. Replies: 1
    Last Post: 11-19-2001, 04:45 PM