Code generation for a parser in minic language

The project consist in extending a parser for

miniC, from a lex and yacc file given by me, with intermediate code generation using the three address instruction.


For a function/procedure call p(x1,x2,…,xn) you should generate code of the form:

*param x1

param x2




param xn

call p,n*


int A[10];

int main(){

int i;

int max;

int sum;

i=0; sum = 0;

while(i < 10){

max = findMax(i);

A[i] = max;

Sum = sum + max;

i = i + 1;




**Should generate:**


i = 0

sum = 0

L1: if i < 10 goto L2

goto L3

L2: putparam i

max = call findMax, 1

A[i] = max

t1 = sum + max

sum = t1

t2 = i + 1

i = t2

goto L1

L3: putparam sum


The output is validated by using the three-address instruction simulator also given.

- Yacc and Lex tools.

The project should pass in the tests given.

Habilidades: Engenharia, MySQL, PHP, Gestão de projetos, Arquitetura de software, Teste de Software

Ver mais: minic language, l2, int i, example for project, c for int, max p, yacc, xn, lex project, address parser project, form generation, php generation, address parser, lex yacc parser, project management tools php, parser code, code language, language address, code generate code php form, address code, yacc code intermediate code, project yacc, generate code, intermediate code yacc, code call

Acerca do Empregador:
( 0 comentários ) Portugal

ID do Projeto: #3014953

1 freelancer is bidding on average $26 for this job


See private message.

$25.5 USD in 3 dias
(42 Comentários)