Skip to content

Commit

Permalink
Add action opcode and new reduce handler
Browse files Browse the repository at this point in the history
  • Loading branch information
alextsao1999 committed Mar 17, 2022
1 parent e2ea279 commit 7956180
Show file tree
Hide file tree
Showing 11 changed files with 3,972 additions and 5,290 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tinylr
a tiny lalr generator inspired by Charles Baker's lalr

generate value_t format ast from grammar
generate json format ast from grammar

glr parser can handle the shift-reduce conflict and reduce-reduce conflict grammar easily

Expand Down
13 changes: 10 additions & 3 deletions debug.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</Expand>
</Type>
<Type Name="ParserState">
<DisplayString Condition="conflict == 0">{{ Index = {index}, Size = {transition_count} }}</DisplayString>
<DisplayString Condition="conflict == 1">{{ Index = {index}, Size = {transition_count}, ShiftReduce }}</DisplayString>
<DisplayString Condition="conflict == 2">{{ Index = {index}, Size = {transition_count}, ReduceReduce }}</DisplayString>
<DisplayString Condition="conflict == 0">{{ Index = {allocated}, Size = {transition_count} }}</DisplayString>
<DisplayString Condition="conflict == 1">{{ Index = {allocated}, Size = {transition_count}, ShiftReduce }}</DisplayString>
<DisplayString Condition="conflict == 2">{{ Index = {allocated}, Size = {transition_count}, ReduceReduce }}</DisplayString>
<!-- <DisplayString>{{ Size = {transition_count} }}</DisplayString>-->
<Expand>
<ArrayItems>
Expand Down Expand Up @@ -89,6 +89,13 @@
<Item Name="[State]">state</Item>
</Expand>
</Type>
<Type Name="ReduceAction">
<Expand>
<Item Name="[Opcode]">((ActionOpcode) opcode)</Item>
<Item Name="[Int]">index</Item>
<Item Name="[Str]">value</Item>
</Expand>
</Type>
<Type Name="alex::RegexRange">
<Expand>
<Item Name="[begin]">((char) begin)</Item>
Expand Down
2,331 changes: 295 additions & 2,036 deletions generator.cpp

Large diffs are not rendered by default.

Loading

0 comments on commit 7956180

Please sign in to comment.