From dfa1359735d6255158b4a9b8b6c3848ab3932840 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 26 May 2024 13:02:20 -0400 Subject: [PATCH] executors/ALGL68: add Algol 68 Genie executor --- dmoj/executors/ALGL68.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dmoj/executors/ALGL68.py diff --git a/dmoj/executors/ALGL68.py b/dmoj/executors/ALGL68.py new file mode 100644 index 000000000..eb619bcc1 --- /dev/null +++ b/dmoj/executors/ALGL68.py @@ -0,0 +1,37 @@ +from typing import List + +from dmoj.cptbox.handlers import ACCESS_EACCES +from dmoj.executors.compiled_executor import CompiledExecutor + + +class Executor(CompiledExecutor): + ext = 'a' + command = 'a68g' + + test_program = ''' +BEGIN + STRING input; + get(standin, input); + print((input, newline)) +END +''' + + data_grace = 131072 + syscalls = [('mkdir', ACCESS_EACCES), 'alarm'] + + def get_compile_args(self) -> List[str]: + command = self.get_command() + assert command is not None + assert self._code is not None + # This doesn't actually compile anything, but will generate useful + # output if the program is malformed. + return [command, '--norun', '--noportcheck', '--nopragmats', self._code] + + def get_cmdline(self, **kwargs) -> List[str]: + command = self.get_command() + assert command is not None + assert self._code is not None + return [command, '--nowarnings', '--noportcheck', '--nopragmats', self._code] + + def get_executable(self): + return self.get_command()