Skip to content

julioc-p/BasicTran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BasicTran

Traductor de BasicTran a Python usando la libreria PLY.

Requisitos

Python 3.-

Prueba ejemplo

Programa que recibe un entero y lo convierte a binario.

with

	var a : int
	var temp : int
	var c: array [32] of int
	var aux: array[32] of int
	var k : int


begin
	print 'I'; print 'n'; print 't'; print 'r'; print 'o'; print 'd'; print 'u'; print 'z'; print 'c'; print 'a';print ' ';
	print 'e';
	print 'l';
	print 'n';
	print 'u';
	print 'm';
	print 'e';
	print 'r';
	print 'o';
	print '\n';

	read(a);

	temp <- 0;
	while a /= 0 ->


		if (a%2 = 0) ->
			aux[temp] <- 0;

		otherwise ->
			aux[temp] <- 1;

		end

		a <- a/2;

		temp <- temp + 1;
	end

	k <-0;


	for k from 0 to temp-1 ->

		c[k] <- aux[temp- k- 1];

	end

	k <- 0;
	print('-');

	for k from 0 to temp-1->

		print(c[k]);

	end
end

Ejecucion

Se ejecuta ./BasicTran

Autores

Leonardo Lopez Almazan,
Julio Perez

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages