From de00af24b9b14834f363255c214c75860afabe9e Mon Sep 17 00:00:00 2001 From: yui-knk Date: Mon, 30 Dec 2024 15:35:41 +0900 Subject: [PATCH] Add definition for Read sets and Follow sets --- lib/lrama/states.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/lrama/states.rb b/lib/lrama/states.rb index 0ed4bff9..f56b0e9b 100644 --- a/lib/lrama/states.rb +++ b/lib/lrama/states.rb @@ -41,6 +41,8 @@ def initialize(grammar, trace_state: false) # value is array of [state.id, nterm.token_id]. @reads_relation = {} + # `Read(p, A) =s DR(p, A) ∪ ∪{Read(r, C) | (p, A) reads (r, C)}` + # # `@read_sets` is a hash whose # key is [state.id, nterm.token_id], # value is bitmap of term. @@ -62,6 +64,8 @@ def initialize(grammar, trace_state: false) # value is array of [state.id, nterm.token_id]. @lookback_relation = {} + # `Follow(p, A) =s Read(p, A) ∪ ∪{Follow(p', B) | (p, A) includes (p', B)}` + # # `@follow_sets` is a hash whose # key is [state.id, rule.id], # value is bitmap of term.