Skip to content

Commit 6394e14

Browse files
committed
Remove Racc as it's now replaced by the parser gem
But keep the Opal version as it's needed by the parser gem.
1 parent cddf58a commit 6394e14

File tree

6 files changed

+4
-67
lines changed

6 files changed

+4
-67
lines changed

Gemfile

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ tilt_version = ENV['TILT_VERSION']
99
rack_version = ENV['RACK_VERSION']
1010
sprockets_version = ENV['SPROCKETS_VERSION']
1111

12-
# Stick with older racc until
13-
# https://github.com/tenderlove/racc/issues/22
14-
# is solved.
15-
gem 'racc', '< 1.4.10', platform: :jruby
1612
gem 'json', '< 1.8.1', platform: :ruby if ruby_version < v['2.2']
1713
gem 'rack-test', '< 0.8' if ruby_version <= v['2.0']
1814
gem 'rubysl', platform: :rbx

Guardfile

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class ::Guard::Opal < Plugin
4949
path = m[0]
5050
puts color("Searching specs for #{m[0]}...", :yellow)
5151
case path
52-
when %r{grammar\.y$} then system 'rake racc'
5352
when %r{^spec/lib} then rspec path
5453
when %r{^spec/ruby} then mspec path
5554
when %r{^opal/corelib}

HACKING.md

+1-35
Original file line numberDiff line numberDiff line change
@@ -195,38 +195,4 @@ Array#permutation_generates_from_a_defensive_copy,_ignoring_mutations
195195

196196
## Parser
197197

198-
## Enabling debug output from Racc
199-
200-
To enable debug output in the Racc grammar set the `RACC_DEBUG` env var and recompile the grammar. While the env variable is set the parser will output the debug info for the parsing process.
201-
202-
```bash
203-
$ export RACC_DEBUG=true
204-
$ bundle exec rake racc # recompile the grammar
205-
$ bundle exec exe/opal --sexp -e "42" # ask Opal for the SExp of some code
206-
207-
read :tINTEGER(tINTEGER) [42, [1, 0]]
208-
209-
shift tINTEGER
210-
[ (tINTEGER [42, [1, 0]]) ]
211-
212-
…cut…
213-
214-
shift $end
215-
[ (program (:int, 42)) ($end [false, [1, 2]]) ($end [false, [1, 2]]) ]
216-
217-
goto 403
218-
[ 0 1 97 403 ]
219-
220-
accept
221-
222-
(:int, 42)
223-
```
224-
225-
When done unset the env variable and recompile the grammar.
226-
227-
```bash
228-
$ unset RACC_DEBUG
229-
$ bundle exec rake racc # recompile the grammar
230-
$ bundle exec exe/opal --sexp -e "42" # ask Opal for the SExp of some code
231-
(:int, 42)
232-
```
198+
Opal relies on the `parser` gem, see debug/development documentation there to know more about its internals: https://whitequark.github.io/parser/.

docs/compiler.md

+3-20
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,12 @@ other runtime helpers.
99

1010
The compiler can be broken down into 3 separate stages:
1111

12-
* lexing
13-
* parsing
12+
* lexing/parsing
1413
* code generation
1514

16-
### Lexer
15+
### Lexer/Parser
1716

18-
The [opal lexer][lexer] is implemented in pure ruby using
19-
the `StringScanner` class from the opal stdlib. The source code is scanned
20-
and tokens are then provided to the parser. This process simply converts
21-
the ruby code given as a string, into a list of tokens representing the
22-
parts of the ruby code.
23-
24-
### Parser
25-
26-
The [opal parser][parser] is implemented using a standard
27-
bison like syntax, but relies on `racc`, a ruby implementation of yacc/bison
28-
which is again available in the standard library. The parser takes these tokens
29-
generated by the lexer and builds a syntax tree representing the ruby code.
30-
This syntax tree is represented by [sexps][sexps]. As
31-
ruby is such a complex and dynamic language, there is a lot of interaction
32-
between the parser and the lexer, namely through a preserved `lex_state`.
17+
The [opal parser][parser] relies on the `parser` gem, see debug/development documentation there to know more about its internals: https://whitequark.github.io/parser/.
3318

3419
### Code generation
3520

@@ -42,8 +27,6 @@ code as well as a reference back to the original sexp which is useful for
4227
generating source maps afterwards.
4328

4429

45-
[lexer]: https://github.com/opal/opal/tree/master/lib/opal/parser/lexer.rb
46-
[parser]: https://github.com/opal/opal/tree/master/lib/opal/parser/grammar.y
4730
[sexps]: https://github.com/opal/opal/tree/master/lib/opal/parser/sexp.rb
4831
[compiler]: https://github.com/opal/opal/tree/master/lib/opal/compiler.rb
4932
[fragments]: https://github.com/opal/opal/tree/master/lib/opal/fragment.rb

opal.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Gem::Specification.new do |spec|
4141

4242
spec.add_development_dependency 'sourcemap', '~> 0.1.0'
4343
spec.add_development_dependency 'rake', '~> 10.0'
44-
spec.add_development_dependency 'racc'
4544
spec.add_development_dependency 'rspec', '~> 3.6.0'
4645
spec.add_development_dependency 'octokit', '~> 2.4.0'
4746
spec.add_development_dependency 'bundler', '~> 1.5'

tasks/building.rake

-6
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ task :dist do
5555
end.map(&:value).map(&method(:puts))
5656
end
5757

58-
desc 'Rebuild grammar.rb for opal parser'
59-
task :racc do
60-
debug_option = '--debug' if ENV['RACC_DEBUG']
61-
sh "racc #{debug_option} -l -o lib/opal/parser/grammar.rb lib/opal/parser/grammar.y"
62-
end
63-
6458
desc 'Remove any generated file.'
6559
task :clobber do
6660
rm_r './build'

0 commit comments

Comments
 (0)