From: "schneems (Richard Schneeman)" Date: 2021-09-11T03:50:56+00:00 Subject: [ruby-core:105192] [Ruby master Bug#18159] Integrate functionality of dead_end gem into Ruby Issue #18159 has been updated by schneems (Richard Schneeman). Thank you for creating the issue, Martin ����. For additional context for anyone who could not see the presentation, I uploaded my RubyKaigi talk as unlisted on YouTube https://youtu.be/DfGG77zVVR4. You can view it when it is done uploading soon. Skip ahead for a demo of `dead_end` parsing source code at 12:51. And then, I do a walk-through of how the algorithm internals works from 15:08 until the end. The first half of the talk sets up the problem, explains the tools (Ripper with lexing and parsing), gives a high-level intro to "AI", and explains why syntax errors are more challenging than standard errors in Ruby. The final algorithm is conceptually based on Dijkstra's algorithm for uniform cost search, hence the artificial intelligence tie-in. The critical insight with `dead_end` was that removing invalid syntax lines from a Ruby document makes it parsable with ripper. We can use this as our goal condition and recursively search the source code using indentation and lexing to determine logical code "blocks". ---------------------------------------- Bug #18159: Integrate functionality of dead_end gem into Ruby https://bugs.ruby-lang.org/issues/18159#change-93597 * Author: duerst (Martin D��rst) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Missing 'end' errors are difficult to fix. We should integrate the functionality of the dead_end gem (https://github.com/zombocom/dead_end) into Ruby similar to how we integrated did_you_mean. It would greatly help programming Ruby, in particular for beginners. See also Ruby Kaigi Takeout 2021 talk by Richard Schneeman https://rubykaigi.org/2021-takeout/presentations/schneems.html. -- https://bugs.ruby-lang.org/ Unsubscribe: