Lrama (pronounced in the same way as the noun “llama” in English) is LALR (1) parser generator written by Ruby. The first goal of this project is providing error tolerant parser for CRuby with minimal changes on CRuby parse.y file.
$ gem install lrama
From source codes,
$ cd "$(lrama root)"
$ bundle install
$ bundle exec rake install
$ bundle exec lrama --version
lrama 0.7.0
# "y.tab.c" and "y.tab.h" are generated
$ lrama -d sample/parse.y
# "calc", "calc.c", and "calc.h" are generated
$ lrama -d sample/calc.y -o calc.c && gcc -Wall calc.c -o calc && ./calc
Enter the formula:
1
=> 1
1+2*3
=> 7
(1+2)*3
=> 9
https://ruby.github.io/lrama/ provides a comprehensive guide to Lrama's features and usage.
master branch)This branch is for Ruby 4.1. lrama_0_8 branch is created from this branch, once Ruby 4.1 is released.
lrama_0_7 branch)This branch is for Ruby 4.0.
lrama_0_6 branch)This branch is for Ruby 3.4.
lrama_0_5 branch)This branch is for Ruby 3.3.
lrama_0_4 branch)This branch generates "parse.c" compatible with Bison 3.8.2 for ruby 3.0, 3.1, 3.2. The first version migrated to ruby is "0.4.0" therefore keep this branch for Bison compatible branch.
See Supported Ruby version in doc.
$ bundle exec rake build:parser
parser.rb is generated from parser.y by Racc.
Run the rake command when you update parser.y then commit changes of both files.
We use Steep for type checking and rbs-inline for type declarations.
Currently, type signatures are declared in the sig/lrama directory. However, these files will be replaced with rbs-inline. This means type signatures should be written directly in the source code.
For guidance on writing type signatures, refer to the Syntax Guide in the rbs-inline documentation.
Running tests:
$ bundle install
$ bundle exec rspec
# or
$ bundle exec rake spec
Running type check:
$ bundle install
$ bundle exec rbs collection install
$ bundle exec steep check
# or
$ bundle exec rake steep
Running both of them:
$ bundle install
$ bundle exec rake
make mainLrama::VERSION and NEWS.mdrake releasecp -r LEGAL.md NEWS.md MIT exe lib template ruby/tool/lramaSee LEGAL.md file.
Ruby
89.0%
C
8.2%
Yacc
2.4%
Lrama (pronounced in the same way as the noun “llama” in English) is LALR (1) parser generator written by Ruby. The first goal of this project is providing error tolerant parser for CRuby with minimal changes on CRuby parse.y file.
$ gem install lrama
From source codes,
$ cd "$(lrama root)"
$ bundle install
$ bundle exec rake install
$ bundle exec lrama --version
lrama 0.7.0
# "y.tab.c" and "y.tab.h" are generated
$ lrama -d sample/parse.y
# "calc", "calc.c", and "calc.h" are generated
$ lrama -d sample/calc.y -o calc.c && gcc -Wall calc.c -o calc && ./calc
Enter the formula:
1
=> 1
1+2*3
=> 7
(1+2)*3
=> 9
https://ruby.github.io/lrama/ provides a comprehensive guide to Lrama's features and usage.
master branch)This branch is for Ruby 4.1. lrama_0_8 branch is created from this branch, once Ruby 4.1 is released.
lrama_0_7 branch)This branch is for Ruby 4.0.
lrama_0_6 branch)This branch is for Ruby 3.4.
lrama_0_5 branch)This branch is for Ruby 3.3.
lrama_0_4 branch)This branch generates "parse.c" compatible with Bison 3.8.2 for ruby 3.0, 3.1, 3.2. The first version migrated to ruby is "0.4.0" therefore keep this branch for Bison compatible branch.
See Supported Ruby version in doc.
$ bundle exec rake build:parser
parser.rb is generated from parser.y by Racc.
Run the rake command when you update parser.y then commit changes of both files.
We use Steep for type checking and rbs-inline for type declarations.
Currently, type signatures are declared in the sig/lrama directory. However, these files will be replaced with rbs-inline. This means type signatures should be written directly in the source code.
For guidance on writing type signatures, refer to the Syntax Guide in the rbs-inline documentation.
Running tests:
$ bundle install
$ bundle exec rspec
# or
$ bundle exec rake spec
Running type check:
$ bundle install
$ bundle exec rbs collection install
$ bundle exec steep check
# or
$ bundle exec rake steep
Running both of them:
$ bundle install
$ bundle exec rake
make mainLrama::VERSION and NEWS.mdrake releasecp -r LEGAL.md NEWS.md MIT exe lib template ruby/tool/lramaSee LEGAL.md file.
Ruby
89.0%
C
8.2%
Yacc
2.4%