23 lines
		
	
	
		
			503 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			503 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Automata\NC;
 | |
| use Program\ProgramParser;
 | |
| 
 | |
| class ProgramLoader
 | |
| {
 | |
| 	public function loadPrograms(NC $machine): void
 | |
| 	{
 | |
| 		$parser = new ProgramParser();
 | |
| 
 | |
| 		foreach (glob(__DIR__ . '/../programs/part/*') as $partProgramFile) {
 | |
| 			$partProgram = $parser->parseFile($partProgramFile);
 | |
| 			$machine->PPM->write($partProgram);
 | |
| 		}
 | |
| 
 | |
| 		foreach (glob(__DIR__ . '/../programs/sub/*') as $subProgramFile) {
 | |
| 			$subProgram = $parser->parseFile($subProgramFile);
 | |
| 			$machine->SPM->write($subProgram);
 | |
| 		}
 | |
| 	}
 | |
| }
 |