probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
28 stars 6 forks source link

Error annotation fails for missing define #649

Open marcoct opened 7 years ago

marcoct commented 7 years ago

I think this is probably one of the more common VentureScript syntax errors, and error annotation seems to fail for it:

venture[script] > a = 1;
Trying to annotate an exception led to:
Traceback (most recent call last):
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/ripl/ripl.py", line 291, in _raise_annotated
    annotated = self._annotated_error(e, instruction)
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/ripl/ripl.py", line 331, in _annotated_error
    instruction_string, e.data['expression_index'], languages)
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/parser/venture_script/parse.py", line 842, in expression_index_to_text_index_in_instruction
    inst = parse_instruction(string, languages)
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/parser/venture_script/parse.py", line 580, in parse_instruction
    ls = parse_instructions(string, languages)
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/parser/venture_script/parse.py", line 577, in parse_instructions
    return map(ast.as_legacy_dict, parse_string(string, languages))
  File "/Users/marco/venturedp_env/lib/python2.7/site-packages/venture/parser/venture_script/parse.py", line 551, in parse_string
    raise e
VentureException: *** text_parse: Syntax error at 1 (token 62)
let(a, 1)
       ^
{'instruction_string': 'let(a, 1)', 'text_index': [7, 7]}

*** parse: "let" first argument must be a list
{'text_index': [0, 8], 'expression_index': [1]}