Closed lgo closed 6 years ago
Ah yeah. I had written that in because I noticed it's also reducable but hadn't yet added it since it requires some changes to simplification. I'll add the Todo.
On Fri, Mar 30, 2018, 09:00 Keri Warr notifications@github.com wrote:
@keriwarr approved this pull request.
Good shit my dude! Only this is that after reading through I didn't see any logic which seemed like it was flattening trees representing lists of items.
In spec/parse_simplification_spec.cr https://github.com/keriwarr/orangejoos/pull/73#discussion_r178286310:
@@ -0,0 +1,37 @@ +require "./spec_helper" +require "../src/orangejoos/parser" +require "../src/orangejoos/parse_tree" + +describe ParseSimplification do
lovely
In src/orangejoos/parser.cr https://github.com/keriwarr/orangejoos/pull/73#discussion_r178286905:
+# For flattening. +enum Marker
- START, STOP +end
+module ParseSimplification
Flattens structures that contain no information. Examples of this
include the following:
- #
1) Trees representing lists of items.
- #
ClassBodyDeclarations
ClassBodyDeclarations
ClassBodyDeclarations
ClassBodyDeclarations
ClassBodyDeclarations
I don't see what causes this to happen
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keriwarr/orangejoos/pull/73#pullrequestreview-108326351, or mute the thread https://github.com/notifications/unsubscribe-auth/ABG332ZvpjO0g0JFK_X6qEY7IvPWGjTfks5tjixygaJpZM4TBMoi .
This will reduce the depth of the parse tree for expressions. Due to how the grammar is designed for handling expression precedence, parsing expressions caused an large tree depth. An iterative based solution was added to traverse through the tree and flatten it.
Ideally, the entire simplification process will be translated to an iterative solution similar to the flattening step in order to prevent recursive depth issues (due to toom any function calls).