Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions workflow for deploying Lrama documentation to GitHub Pages #502

Merged
merged 3 commits into from
Jan 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add RDoc documentation generation and initial documentation files
ydah committed Jan 6, 2025
commit 1ed8423622a03b2176ee9cd37474119e8c7bc5ff
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -10,3 +10,4 @@
/tmp/
/vendor/bundle
/.idea/
_site/
2 changes: 2 additions & 0 deletions .rdoc_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
page_dir: doc
warn_missing_rdoc_ref: true
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -15,6 +15,13 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
end
task :spec => "build:parser"

require "rdoc/task"
RDoc::Task.new do |rdoc|
rdoc.title = "Lrama Documentation"
rdoc.main = "Index.md"
rdoc.rdoc_dir = "_site"
end

desc "steep check"
task :steep do
sh "bundle exec steep check"
58 changes: 58 additions & 0 deletions doc/Index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Lrama

[![Gem Version](https://badge.fury.io/rb/lrama.svg)](https://badge.fury.io/rb/lrama)
[![build](https://github.com/ruby/lrama/actions/workflows/test.yaml/badge.svg)](https://github.com/ruby/lrama/actions/workflows/test.yaml)


## Overview

Lrama 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.

## Installation

Lrama's installation is simple. You can install it via RubyGems.

```shell
$ gem install lrama
```

From source codes, you can install it as follows:

```shell
$ cd "$(lrama root)"
$ bundle install
$ bundle exec rake install
$ bundle exec lrama --version
lrama 0.6.11
```
## Usage

Lrama is a command line tool. You can generate a parser from a grammar file by running `lrama` command.

```shell
# "y.tab.c" and "y.tab.h" are generated
$ lrama -d sample/parse.y
```
Specify the output file with `-o` option. The following example generates "calc.c" and "calc.h".

```shell
# "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
```

## Supported Ruby version

Lrama is executed with BASERUBY when building ruby from source code. Therefore Lrama needs to support BASERUBY, currently 2.5, or later version.

This also requires Lrama to be able to run with only default gems because BASERUBY runs with `--disable=gems` option.

## License

See [LEGAL.md](https://github.com/ruby/lrama/blob/master/LEGAL.md) file.