Contoh Program Kompilator Teknik Kompilasi dengan PHP

Sekedar sharing tugas siapa tahu ada yang membutuhkan.. mata kuliah teknik kompilasi menggunakan metode Quadruples Notation
monggo di download…
seperti ini tampilannya gan

tampilan tekkom

tampilan tekkom

ini script utamanya gan…

<?php
 if(isset($_POST)):
 	$input1 = $_POST['in1'];
 	$input2 = $_POST['in2'];
 	$operand = $_POST['operand'];
 	$hasil = $_POST['hasil'];
 	

 	if($input1 == '' && $input2 == '' && $hasil == '' && $operand == ''){
 		echo "Mohon periksa lagi inputan anda"; 		
 	}else{

 		if ($operand != '+' && $operand != '-' &&  $operand != 'x' && $operand != ':' && $operand != '*' && $operand != '/') {
		 	echo "Mohon masukkan operator aritmatik";
	 	}else{

	 		$temp1 = explode(" ", $input1);
		 		$subInput1 = $temp1[0];
		 		$subInput2 = $temp1[1];
		 		$subInput3 = $temp1[2];
		 	$temp2 = explode(" ", $input2);
		 		$subInput11 = $temp2[0];
		 		$subInput12 = $temp2[1];
		 		$subInput13 = $temp2[2];

	 		if ($subInput2 != '+' && $subInput2 != '-' &&  $subInput2 != 'x' && $subInput2 != ':' && $subInput2 != '*' && $subInput2 != '/' && $subInput12 != '+' && $subInput12 != '-' &&  $subInput12 != 'x' && $subInput12 != ':' && $subInput12 != '*' && $subInput12 != '/') {
				echo "Mohon periksa lagi inputan anda";
			}else{
				echo '1.&nbsp;&nbsp;&nbsp; '.$subInput2.', '.$subInput1.', '.$subInput3.', '.'T1<br>';
		 		echo '2.&nbsp;&nbsp;&nbsp; '.$subInput12.', '.$subInput11.', '.$subInput13.', '.'T2<br>';
		 		echo '3.&nbsp;&nbsp;&nbsp; '.$operand.', '.'T1, T2, T3';
			}	 		
	 	} 		
 	} 	
 	
 endif;
?>


hasilnya kyk gini gan metode Quadruples Notation
hasil

kalau mau program ini silahkan download disini…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s