示例#1
0
 public function compileCode($language, $codeFile)
 {
     switch ($language) {
         case '1':
             require_once "Compiler/CCompiler.php";
             $cCompiler = new CCompiler($codeFile);
             $output = $cCompiler->compile();
             break;
         case '2':
             require_once "Compiler/CppCompiler.php";
             $cppCompiler = new CppCompiler($codeFile);
             $cppCompiler->compile();
             break;
         case '3':
             require_once "Compiler/JavaCompiler.php";
             $javaCompiler = new JavaCompiler($codeFile);
             $javaCompiler->compile();
             break;
     }
     return $output;
 }
示例#2
0
<?php

if (isset($_POST['code'])) {
    require_once "Repositories/CR_File.php";
    require_once "Compiler/CCompiler.php";
    $codeFilePath = "public/output/reviewCode.c";
    $file = new CR_File($codeFilePath);
    $file->write($_POST['code']);
    $compiler = new CCompiler($file);
    $output = $compiler->compile();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>CodeRead</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="public/assets/css/bootstrap.min.css" rel="stylesheet">
  <link href="public/assets/css/bootstrap-theme.min.css" rel="stylesheet">
  <style type="text/css">
    .starter-template {
      padding: 40px 15px;
      text-align: center;
    }
    body {
      padding-top: 70px;
      padding-bottom: 30px;
    }