Search code examples
compiler-construction

How to write array in triple form? e.g. A[i] (Compiler Design)


for, a=b+c,

we write,

    op     arg1     arg2

1   +       b          c
2   =       a           (1)

Then How to write A[i]


Solution

  • For the example expression:

    a=b+A[i][j] 
    

    You get the following:

    op         arg1     arg2
    
    1   index  A        i
    2   index (1)       j
    3   +      b       (2)
    4   =      a       (3)
    

    As @Johan suggesgted you can write [] instead of index.