This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
# include "sintatico.tab.h" | |
# include <string.h> | |
%} | |
%% | |
([0-9]{1,})((\.)?[0-9]{1,})? {return NUM;} | |
("var") {return VAR;} | |
("leia") {return LEIA;} | |
("escreva") {return ESCREVA;} | |
("int"|"float") {yylval.id = (char *) strdup(yytext); return TIPO;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://www.geeksforgeeks.org/program-best-fit-algorithm-memory-management/ | |
def print_allocation(n, allocation, process_size): | |
print("Process No.\tProcess Size\tBlock no.") | |
for i in range(n): | |
print("%d\t\t%d\t\t" % (i+1, process_size[i]), | |
allocation[i] + 1 if allocation[i] != -1 | |
else "Not Allocated", sep='' | |
) | |
def first_fit(block_size, process_size): |