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

Please allow parenthesis for define not square bracket in venchurch #168

Open fsaad opened 9 years ago

fsaad commented 9 years ago
venture[script] > (define u (list 1 2))
Trying to annotate an exception led to:
Traceback (most recent call last):
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/ripl/ripl.py", line 176, in _raise_annotated
    annotated = self._annotated_error(e, instruction)
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/ripl/ripl.py", line 213, in _annotated_error
    args, arg_ranges = p.split_instruction(instruction_string)
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/parser/church_prime/parse.py", line 532, in split_instruction
    l = parse_instruction(string)
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/parser/church_prime/parse.py", line 310, in parse_instruction
    ls = parse_instructions(string)
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/parser/church_prime/parse.py", line 307, in parse_instructions
    return parse_church_prime_string(string)
  File "/home/fsaad/Documents/pcp/Venturecxx/build/lib.linux-x86_64-2.7/venture/parser/church_prime/parse.py", line 304, in parse_church_prime_string
    raise e
VentureException: *** parse: Syntax error at 'define'
(define u (list 1 2))
 ^^^^^^
{'instruction_string': '(define u (list 1 2))', 'text_index': [1, 6]}

*** parse: Syntax error at 'define'
(define u (list 1 2))
 ^^^^^^
{'instruction_string': '(define u (list 1 2))', 'text_index': [1, 6]}
venture[script] > [define u (list 1 2)]
[1.0, 2.0]
fsaad commented 9 years ago

Also infer, list_directives and others.

axch commented 8 years ago

Now this should only affect define, infer, and load. But parenthesized versions of those are probably good to have.