Venturecxx icon indicating copy to clipboard operation
Venturecxx copied to clipboard

Clean up parsing code

Open axch opened this issue 9 years ago • 4 comments

Enabled by (or noticed during?) f5683f157b4193be63e84a237f919c2889cda7da .

  • [x] The whole split_program pattern is redundant, because it cycles through the parser's ability to parse multi-instruction streams anyway.
  • [ ] split_instruction in the parsers should be pretty useless; flush it?
  • [ ] expression_index_to_text_index in the parsers is looking pretty useless; flush it?

axch avatar Dec 26 '15 03:12 axch

Entry points into parsing:

  • Console calls ripl.execute_instruction or ripl.execute_instructions
  • ripl.execute_instructions calls
    • p.split_program
    • p.parse_instruction
    • then ripl.execute_parsed_instruction
  • ripl.execute_instruction calls
    • p.parse_instruction or
    • ripl._ensure_parsed
    • then ripl.execute_parsed_instruction
  • ripl.execute_program{,_from_file} calls
    • ripl.parse_program which
      • does the horrible thing with the comments
      • calls ripl.split_program
      • calls ripl._ensure_parsed
    • ripl.execute_parsed_program
      • which special-cases "load" instructions!?
  • ripl._ensure_parsed bottoms out in
    • p.parse_expression
    • p.parse_number

The error reporting also interacts with the parser

  • split_instruction is used for annotation (after the fact)

All of which bottom out in parse_instructions (with various manipulations of the returned location dicts).

axch avatar Jan 04 '16 19:01 axch

Please flush all the splitting crud!

riastradh-probcomp avatar Jan 04 '16 19:01 riastradh-probcomp

Do I detect evidence of a splitting headache?

axch avatar Jan 04 '16 19:01 axch

Yes -- standard remedy is to drink lots of water to flush it out.

riastradh-probcomp avatar Jan 04 '16 19:01 riastradh-probcomp