rley 0.0.07 → 0.0.08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/parser/earley_parser.rb +5 -1
- data/spec/rley/support/grammar_abc.rb +22 -0
- data/spec/rley/support/grammar_helper.rb +16 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzI5OGY5NWE3MzQ1OGQ4NjFmOGIyMjQ4ZTM4Y2M0NzE4YTg2ZmRhMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmNhYWMxODI3YjQ1NTMyYzk4NmE5NDk3Yzc4YTc4NTQzNjk0MzNkZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZmZGFhMDVjMGI1YjQ0ZGUwNjIyMmMwNzBkYWRkOTVkMGU4ZGJhNGQ3ZDFi
|
10
|
+
YzRmMTdlMDBhZTlhOWZlMWVlNjM1ZWRhZWY5NzQ2Y2EyNDJhYzg2YWJhYjU3
|
11
|
+
YjNmMTQ5MzgwNmRlYTEyNmEyNTc1YjdhZjgxNTQ4YTNmYTA2MjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGE3MDM5OTNlNDEwN2EwMTQzZGQ2ZmMzNmUyNjVmMGY2MmQ0MjRlMWJkMmM1
|
14
|
+
NDI3YWEzNTlhYTQzMDZlNDZjYmI1NzNiNTYwMDI0NGY4NmI4NGQ4Yjc3OGQ5
|
15
|
+
ZmE4MDQ3ZjZmYTljYTg0YjEyOWYzMmU5ODUyOTU4Yjk5MWJjZGY=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.0.08 / 2014-11-14
|
2
|
+
* [CHANGE] `EarleyParser#parse` method: Initial API documentation.
|
3
|
+
* [INFO] This version was committed to force Travis CI to execute a complete build (failed because Travis couldn't connect to GitHub)
|
4
|
+
|
1
5
|
### 0.0.07 / 2014-11-14
|
2
6
|
* [CHANGE] spec file of `EarleyParser` class: Test added. Parser works with simple expression grammar.
|
3
7
|
|
data/lib/rley/constants.rb
CHANGED
@@ -20,7 +20,8 @@ module Rley # This module is used as a namespace
|
|
20
20
|
# after "advancing" the dot
|
21
21
|
attr_reader(:next_mapping)
|
22
22
|
|
23
|
-
|
23
|
+
# @param aGrammar [Grammar] A context-free grammar that defines the language
|
24
|
+
# of the input to be parsed.
|
24
25
|
def initialize(aGrammar)
|
25
26
|
@grammar = aGrammar
|
26
27
|
@dotted_items = build_dotted_items(grammar)
|
@@ -28,6 +29,9 @@ module Rley # This module is used as a namespace
|
|
28
29
|
@next_mapping = build_next_mapping(dotted_items)
|
29
30
|
end
|
30
31
|
|
32
|
+
# @param aTokenSequence [Array] Array of Tokens objects returned by a
|
33
|
+
# tokenizer/scanner/lexer.
|
34
|
+
# @return a Parsing object that embeds the parse result.
|
31
35
|
def parse(aTokenSequence)
|
32
36
|
result = Parsing.new(start_dotted_item, aTokenSequence)
|
33
37
|
last_token_index = aTokenSequence.size
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../../../lib/rley/syntax/verbatim_symbol'
|
2
|
+
require_relative '../../../lib/rley/syntax/non_terminal'
|
3
|
+
require_relative '../../../lib/rley/syntax/production'
|
4
|
+
require_relative '../../../lib/rley/parser/token'
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
# Grammar 1: A very simple language
|
9
|
+
# (based on example in N. Wirth "Compiler Construction" book, p. 6)
|
10
|
+
# S ::= A.
|
11
|
+
# A ::= "a" A "c".
|
12
|
+
# A ::= "b".
|
13
|
+
# Let's create the grammar piece by piece
|
14
|
+
let(:nt_S) { Syntax::NonTerminal.new('S') }
|
15
|
+
let(:nt_A) { Syntax::NonTerminal.new('A') }
|
16
|
+
let(:a_) { Syntax::VerbatimSymbol.new('a') }
|
17
|
+
let(:b_) { Syntax::VerbatimSymbol.new('b') }
|
18
|
+
let(:c_) { Syntax::VerbatimSymbol.new('c') }
|
19
|
+
let(:prod_S) { Syntax::Production.new(nt_S, [nt_A]) }
|
20
|
+
let(:prod_A1) { Syntax::Production.new(nt_A, [a_, nt_A, c_]) }
|
21
|
+
let(:prod_A2) { Syntax::Production.new(nt_A, [b_]) }
|
22
|
+
let(:grammar_abc) { Syntax::Grammar.new([prod_S, prod_A1, prod_A2]) }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../../../lib/rley/syntax/verbatim_symbol'
|
2
|
+
require_relative '../../../lib/rley/syntax/non_terminal'
|
3
|
+
require_relative '../../../lib/rley/syntax/production'
|
4
|
+
require_relative '../../../lib/rley/syntax/grammar'
|
5
|
+
|
6
|
+
module Rley # This module is used as a namespace
|
7
|
+
# Mix-in module that provides factory methods that simplify the construction
|
8
|
+
# of a grammar from its constituents.
|
9
|
+
module GrammarHelper
|
10
|
+
# Create a production
|
11
|
+
def production()
|
12
|
+
end
|
13
|
+
end # module
|
14
|
+
end # module
|
15
|
+
|
16
|
+
# End of file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.08
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
@@ -108,6 +108,8 @@ files:
|
|
108
108
|
- spec/rley/parser/parsing_spec.rb
|
109
109
|
- spec/rley/parser/state_set_spec.rb
|
110
110
|
- spec/rley/parser/token_spec.rb
|
111
|
+
- spec/rley/support/grammar_abc.rb
|
112
|
+
- spec/rley/support/grammar_helper.rb
|
111
113
|
- spec/rley/syntax/grammar_spec.rb
|
112
114
|
- spec/rley/syntax/grm_symbol_spec.rb
|
113
115
|
- spec/rley/syntax/literal_spec.rb
|