Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 21.8 KB

14-brackets-exponentiation.md

File metadata and controls

32 lines (26 loc) · 21.8 KB

Issue 14: Brackets with Exponentiation

Description

There was a bug with the interpreter that resulted in the error localizer throwing an error for a program that should have been accepted.

Inputs that worked with the error localizer

# These sets of inputs work with the error localizer
base_program_string = "def random_operation(num1, num2, num3):\n\tresult = 2 ** 3\n\treturn result"
modified_program_string = "def random_operation(num1, num2, num3):\n\tresult = 2 ** 3\n\treturn result"
function_name = "random_operation"
function_arguments = "[[97044.82573510814,52678.26208957573,88456.26143378939]]"

Inputs that did not work with the error localizer

# These sets of inputs do not work with the error localizer
# Error localizer exception: Expecting value: line 1 column 1 (char 0)
base_program_string = "def random_operation(num1, num2, num3):\n\tresult = (num1 * (num3 ** 2)) / num2\n\treturn result"
modified_program_string = "def random_operation(num1, num2, num3):\n\tresult = (num1 * (num3 ** 2)) / num2\n\treturn result"
function_name = "random_operation"
function_arguments = "[[97044.82573510814,52678.26208957573,88456.26143378939]]"

Error localizer input that did not work

{"language": "py", "reference_solution": "{\n    \"importStatements\": [],\n    \"fncs\": {\n        \"random_operation\": {\n            \"name\": \"random_operation\",\n            \"rettype\": \"*\",\n            \"initloc\": 1,\n            \"endloc\": 0,\n            \"params\": [\n                {\n                    \"val0\": \"num1\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num1\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num1\",\n                        \"*\"\n                    ]\n                },\n                {\n                    \"val0\": \"num2\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num2\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num2\",\n                        \"*\"\n                    ]\n                },\n                {\n                    \"val0\": \"num3\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num3\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num3\",\n                        \"*\"\n                    ]\n                }\n            ],\n            \"locexprs\": {\n                \"1\": [\n                    {\n                        \"val0\": \"result\",\n                        \"val1\": {\n                            \"name\": \"Div\",\n                            \"args\": [\n                                {\n                                    \"name\": \"Mult\",\n                                    \"args\": [\n                                        {\n                                            \"name\": \"num1\",\n                                            \"primed\": false,\n                                            \"line\": 2,\n                                            \"tokentype\": \"Variable\"\n                                        },\n                                        {\n                                            \"name\": \"Pow\",\n                                            \"args\": [\n                                                {\n                                                    \"name\": \"num3\",\n                                                    \"primed\": false,\n                                                    \"line\": 2,\n                                                    \"tokentype\": \"Variable\"\n                                                },\n                                                {\n                                                    \"value\": \"2\",\n                                                    \"line\": 2,\n                                                    \"tokentype\": \"Constant\"\n                                                }\n                                            ],\n                                            \"line\": 2,\n                                            \"tokentype\": \"Operation\"\n                                        }\n                                    ],\n                                    \"line\": 2,\n                                    \"tokentype\": \"Operation\"\n                                },\n                                {\n                                    \"name\": \"num2\",\n                                    \"primed\": false,\n                                    \"line\": 2,\n                                    \"tokentype\": \"Variable\"\n                                }\n                            ],\n                            \"line\": 2,\n                            \"tokentype\": \"Operation\"\n                        },\n                        \"valueArray\": [\n                            \"result\",\n                            {\n                                \"name\": \"Div\",\n                                \"args\": [\n                                    {\n                                        \"name\": \"Mult\",\n                                        \"args\": [\n                                            {\n                                                \"name\": \"num1\",\n                                                \"primed\": false,\n                                                \"line\": 2,\n                                                \"tokentype\": \"Variable\"\n                                            },\n                                            {\n                                                \"name\": \"Pow\",\n                                                \"args\": [\n                                                    {\n                                                        \"name\": \"num3\",\n                                                        \"primed\": false,\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Variable\"\n                                                    },\n                                                    {\n                                                        \"value\": \"2\",\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Constant\"\n                                                    }\n                                                ],\n                                                \"line\": 2,\n                                                \"tokentype\": \"Operation\"\n                                            }\n                                        ],\n                                        \"line\": 2,\n                                        \"tokentype\": \"Operation\"\n                                    },\n                                    {\n                                        \"name\": \"num2\",\n                                        \"primed\": false,\n                                        \"line\": 2,\n                                        \"tokentype\": \"Variable\"\n                                    }\n                                ],\n                                \"line\": 2\n                            }\n                        ],\n                        \"valueList\": [\n                            \"result\",\n                            {\n                                \"name\": \"Div\",\n                                \"args\": [\n                                    {\n                                        \"name\": \"Mult\",\n                                        \"args\": [\n                                            {\n                                                \"name\": \"num1\",\n                                                \"primed\": false,\n                                                \"line\": 2,\n                                                \"tokentype\": \"Variable\"\n                                            },\n                                            {\n                                                \"name\": \"Pow\",\n                                                \"args\": [\n                                                    {\n                                                        \"name\": \"num3\",\n                                                        \"primed\": false,\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Variable\"\n                                                    },\n                                                    {\n                                                        \"value\": \"2\",\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Constant\"\n                                                    }\n                                                ],\n                                                \"line\": 2,\n                                                \"tokentype\": \"Operation\"\n                                            }\n                                        ],\n                                        \"line\": 2,\n                                        \"tokentype\": \"Operation\"\n                                    },\n                                    {\n                                        \"name\": \"num2\",\n                                        \"primed\": false,\n                                        \"line\": 2,\n                                        \"tokentype\": \"Variable\"\n                                    }\n                                ],\n                                \"line\": 2\n                            }\n                        ]\n                    },\n                    {\n                        \"val0\": \"$ret\",\n                        \"val1\": {\n                            \"name\": \"result\",\n                            \"primed\": true,\n                            \"line\": 3,\n                            \"tokentype\": \"Variable\"\n                        },\n                        \"valueArray\": [\n                            \"$ret\",\n                            {\n                                \"name\": \"result\",\n                                \"primed\": true,\n                                \"line\": 3\n                            }\n                        ],\n                        \"valueList\": [\n                            \"$ret\",\n                            {\n                                \"name\": \"result\",\n                                \"primed\": true,\n                                \"line\": 3\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"loctrans\": {\n                \"1\": {}\n            },\n            \"locdescs\": {\n                \"1\": \"around the beginning of function 'random_operation'\"\n            },\n            \"types\": {\n                \"result\": \"*\"\n            }\n        }\n    }\n}", "student_solution": "{\n    \"importStatements\": [],\n    \"fncs\": {\n        \"random_operation\": {\n            \"name\": \"random_operation\",\n            \"rettype\": \"*\",\n            \"initloc\": 1,\n            \"endloc\": 0,\n            \"params\": [\n                {\n                    \"val0\": \"num1\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num1\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num1\",\n                        \"*\"\n                    ]\n                },\n                {\n                    \"val0\": \"num2\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num2\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num2\",\n                        \"*\"\n                    ]\n                },\n                {\n                    \"val0\": \"num3\",\n                    \"val1\": \"*\",\n                    \"valueArray\": [\n                        \"num3\",\n                        \"*\"\n                    ],\n                    \"valueList\": [\n                        \"num3\",\n                        \"*\"\n                    ]\n                }\n            ],\n            \"locexprs\": {\n                \"1\": [\n                    {\n                        \"val0\": \"result\",\n                        \"val1\": {\n                            \"name\": \"Div\",\n                            \"args\": [\n                                {\n                                    \"name\": \"Mult\",\n                                    \"args\": [\n                                        {\n                                            \"name\": \"num1\",\n                                            \"primed\": false,\n                                            \"line\": 2,\n                                            \"tokentype\": \"Variable\"\n                                        },\n                                        {\n                                            \"name\": \"Pow\",\n                                            \"args\": [\n                                                {\n                                                    \"name\": \"num3\",\n                                                    \"primed\": false,\n                                                    \"line\": 2,\n                                                    \"tokentype\": \"Variable\"\n                                                },\n                                                {\n                                                    \"value\": \"2\",\n                                                    \"line\": 2,\n                                                    \"tokentype\": \"Constant\"\n                                                }\n                                            ],\n                                            \"line\": 2,\n                                            \"tokentype\": \"Operation\"\n                                        }\n                                    ],\n                                    \"line\": 2,\n                                    \"tokentype\": \"Operation\"\n                                },\n                                {\n                                    \"name\": \"num2\",\n                                    \"primed\": false,\n                                    \"line\": 2,\n                                    \"tokentype\": \"Variable\"\n                                }\n                            ],\n                            \"line\": 2,\n                            \"tokentype\": \"Operation\"\n                        },\n                        \"valueArray\": [\n                            \"result\",\n                            {\n                                \"name\": \"Div\",\n                                \"args\": [\n                                    {\n                                        \"name\": \"Mult\",\n                                        \"args\": [\n                                            {\n                                                \"name\": \"num1\",\n                                                \"primed\": false,\n                                                \"line\": 2,\n                                                \"tokentype\": \"Variable\"\n                                            },\n                                            {\n                                                \"name\": \"Pow\",\n                                                \"args\": [\n                                                    {\n                                                        \"name\": \"num3\",\n                                                        \"primed\": false,\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Variable\"\n                                                    },\n                                                    {\n                                                        \"value\": \"2\",\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Constant\"\n                                                    }\n                                                ],\n                                                \"line\": 2,\n                                                \"tokentype\": \"Operation\"\n                                            }\n                                        ],\n                                        \"line\": 2,\n                                        \"tokentype\": \"Operation\"\n                                    },\n                                    {\n                                        \"name\": \"num2\",\n                                        \"primed\": false,\n                                        \"line\": 2,\n                                        \"tokentype\": \"Variable\"\n                                    }\n                                ],\n                                \"line\": 2\n                            }\n                        ],\n                        \"valueList\": [\n                            \"result\",\n                            {\n                                \"name\": \"Div\",\n                                \"args\": [\n                                    {\n                                        \"name\": \"Mult\",\n                                        \"args\": [\n                                            {\n                                                \"name\": \"num1\",\n                                                \"primed\": false,\n                                                \"line\": 2,\n                                                \"tokentype\": \"Variable\"\n                                            },\n                                            {\n                                                \"name\": \"Pow\",\n                                                \"args\": [\n                                                    {\n                                                        \"name\": \"num3\",\n                                                        \"primed\": false,\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Variable\"\n                                                    },\n                                                    {\n                                                        \"value\": \"2\",\n                                                        \"line\": 2,\n                                                        \"tokentype\": \"Constant\"\n                                                    }\n                                                ],\n                                                \"line\": 2,\n                                                \"tokentype\": \"Operation\"\n                                            }\n                                        ],\n                                        \"line\": 2,\n                                        \"tokentype\": \"Operation\"\n                                    },\n                                    {\n                                        \"name\": \"num2\",\n                                        \"primed\": false,\n                                        \"line\": 2,\n                                        \"tokentype\": \"Variable\"\n                                    }\n                                ],\n                                \"line\": 2\n                            }\n                        ]\n                    },\n                    {\n                        \"val0\": \"$ret\",\n                        \"val1\": {\n                            \"name\": \"result\",\n                            \"primed\": true,\n                            \"line\": 3,\n                            \"tokentype\": \"Variable\"\n                        },\n                        \"valueArray\": [\n                            \"$ret\",\n                            {\n                                \"name\": \"result\",\n                                \"primed\": true,\n                                \"line\": 3\n                            }\n                        ],\n                        \"valueList\": [\n                            \"$ret\",\n                            {\n                                \"name\": \"result\",\n                                \"primed\": true,\n                                \"line\": 3\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"loctrans\": {\n                \"1\": {}\n            },\n            \"locdescs\": {\n                \"1\": \"around the beginning of function 'random_operation'\"\n            },\n            \"types\": {\n                \"result\": \"*\"\n            }\n        }\n    }\n}", "function": "random_operation", "inputs": "[]", "args": "[[97044.82573510814,52678.26208957573,88456.26143378939]]"}

Status

This has been confirmed as a bug by Zhiyu from the ITS API team on 7 April 2024. The bug has been acknowledged and fixed accordingly.