Questions tagged [intermediate-code]

44 questions
1
vote
3 answers

Easiest way to work with intermediate format

A tool I'm working on needs to take the intermediate format generated by the compiler, add some code to it and then give that modified intermediate code to the backend of the compiler to generate the final code. By doing a little research on gcc, I…
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
1
vote
3 answers

Avergaging elements in array

I'm trying to add the elements in an array. It's just a simple program to calculate the average of student grades. I know this is probably a rudimentary way to code this, I'm looking to do it more efficiently. However my code is not returning the…
N3Xxus6
  • 11
  • 2
1
vote
1 answer

Creating custom calculations using JavaScript (jQuery)

I wish to take the value of an HTML string contained within tags - perform a calculation on it - and output the results in a separate string, dependent on which input is selected on-page. The source value changes dynamically based…
1
vote
4 answers

efficiently searching arrays without using index?

So I am making a text based rpg for a class. Currently the functionality is working for one room which is all I currently want. However I want a more efficient way of doing this. I want to do this without indexes. I want to print a list of elements…
1
vote
1 answer

What is a three address code for this equation?

The equation I have is x = y+z; I have seen that when solving problems where x = y+z x,y,z are variables which are often converted to three address code like this: t1 = y+z; x = t1; My doubt is when x = y+z is itself a three address code and…
1
vote
4 answers

How can you make a decimal input valid?

I have written this code, however, every time I input a decimal value, it doesn't work. How can I make this code work even if I input a decimal value? For example, if I input a value of 7.5, it should display that "the shipping cost is $9.45" …
grif389
  • 11
  • 1
1
vote
0 answers

Can someone explain how Stanford university intermediate format (SUIF) works?

I recently encountered a term SUIF in a compiler design class. I tried to study about it but could not understand the overview of it from the documents of SUIF website. I could only get that it's based on object oriented style and follows a tree…
Dhineshkumar
  • 109
  • 10
1
vote
1 answer

How to represent structure in a C like language in 3-address code?

What is the three address code IR for a C code-snippet declaring a structure? struct name{ char c; int i; }
1
vote
2 answers

Using a pre-parsed protocol definition in a script and keeping it up-to-date

For my work, I sometimes have to deal with logfiles from a binary protocol (the logfiles contain hexdumps of the messages). I want to write a Perl script that can interpret the binary data for me and print the contents in a more friendly format. I…
Bart van Ingen Schenau
  • 15,488
  • 4
  • 32
  • 41
1
vote
2 answers

Specification of Scala compiler's intermediate code

Is there any formal specification or detailed description of the intermediate code generated by the Scala compiler (i.e. passing the -Xprint-icode option to scalac)? Thanks.
ale64bit
  • 6,232
  • 3
  • 24
  • 44
1
vote
1 answer

automatic pseudo code to c language converter

I'm trying to write a translator for pseudo-code to c language.which phases of compiler are necessary? I tried lexical,syntax,semantic,intermediate code is enough or machine code is necessary. I tried flex,bison for the above phases. Is it correct?
Tintu James
  • 113
  • 1
  • 13
1
vote
1 answer

Is there a GCC option to treat foo() as foo(void)?

I'm creating a compiler for a language that outputs GNU C as intermediate code. (yes, I know there's better ways of doing IR, but I'm lazy and I'm going to rewrite it to be self-hosting anyway). Currently if I make a function with no arguments, my…
Michael Rawson
  • 1,905
  • 1
  • 15
  • 25
0
votes
0 answers

Three Address code for an arithmetic operation containing only integers?

I am trying to convert a miniC program (limited features) into a 3AC using lex and yacc. I read a bit about it on google but all the examples given always have some variable in their operations. What If in the source code theres something like…
Tony
  • 81
  • 9
0
votes
0 answers

Stuck in for loop while generating pseudocode from three address code in Python

I need help in writing a python code that takes in the Three Address Code for the Java source code and returns pseudo code. I have successfully generated pseudo code for 1-D array initialization by extracting the array names, their length, and…
0
votes
0 answers

how to use python multithreading to sum arrays of integers

I hope I can explain this well enough. I'm suppose to make a main master thread that aggregates and sums together the work of several slave threads. The amount of slave threads is N and varies. These slave threads each individually produce an array…