Skip to content

Commit

Permalink
update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rrevenantt committed Feb 1, 2021
1 parent e276292 commit 2fb4aab
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 17 deletions.
26 changes: 26 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[The "BSD 3-clause license"]
Copyright (c) 2020-2021 Konstantin Anisimov. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
[![docs](https://flat.badgen.net/badge/docs.rs/v0.2.0)](https://docs.rs/antlr-rust/0.2.0)
![ANTLR4 testsuite](https://github.com/rrevenantt/antlr4rust/workflows/ANTLR4%20testsuite/badge.svg?event=push)
![cargo test](https://github.com/rrevenantt/antlr4rust/workflows/cargo%20test/badge.svg)
[![](https://tokei.rs/b1/github/rrevenantt/antlr4rust)](https://github.com/rrevenantt/antlr4rust)

[ANTLR4](https://github.com/antlr/antlr4) runtime for Rust programming language.

Tool(generator) part is currently located in rust-target branch of my antlr4 fork [rrevenantt/antlr4/tree/rust-target](https://github.com/rrevenantt/antlr4/tree/rust-target)
Latest version is automatically built to [releases](https://github.com/rrevenantt/antlr4rust/releases) on this repository.

For examples you can see [grammars](grammars), [tests/gen](tests/gen) for corresponding generated code
and [tests/my_tests.rs](tests/my_test.rs) for actual usage examples

## Building antlr4/rust-target Tool(generator)
## ANTLR4 Tool(parser generator)

Generator part is currently located in rust-target branch of my antlr4 fork [rrevenantt/antlr4/tree/rust-target](https://github.com/rrevenantt/antlr4/tree/rust-target)
Latest version is automatically built to [releases](https://github.com/rrevenantt/antlr4rust/releases) on this repository.
So if you just want to generate parser
or if you want to contribute to only runtime part you don't have to do build it yourself.

If you would like to work with the rust-target, in the antlr4 repo:
* `git clone https://github.com/rrevenantt/antlr4`
* `git checkout rust-target`
* `git submodule update --init --recursive`
* `mvn -DskipTests install`
But if you want to build or change generator yourself:
* `git clone -b rust-target https://github.com/rrevenantt/antlr4` - clone my antlr4 fork
* `git submodule update --init --recursive` - update Rust target submodule
* `mvn -DskipTests install` - build generator

### Implementation status

Expand All @@ -37,9 +39,6 @@ Remaining things before merge:
Can be done after merge:
- Documentation
- [ ] Some things are already documented but still far from perfect, also more links needed.
- Code quality
- [ ] Clippy sanitation
- [ ] Not all warning are fixed
- cfg to not build potentially unnecessary parts
(no Lexer if custom token stream, no ParserATNSimulator if LL(1) grammar)
- run rustfmt on generated parser
Expand All @@ -54,7 +53,7 @@ Can be done after merge:
### Usage

You should use the ANTLR4 "tool" to generate a parser, that will use the ANTLR
runtime, located here. You can run it with the following command:
runtime located here. You can run it with the following command:
```bash
java -jar <path to ANTLR4 tool> -Dlanguage=Rust MyGrammar.g4
```
Expand Down Expand Up @@ -137,4 +136,7 @@ patch version changes of the crate should not require updating of generator part

## Licence

BSD 3-clause
BSD 3-clause.
Unless you explicitly state otherwise,
any contribution intentionally submitted for inclusion in this project by you
shall be licensed as above, without any additional terms or conditions.
5 changes: 2 additions & 3 deletions tests/gen/referencetoatnparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ where
}

/// Trait for monomorphized trait object that corresponds to the nodes of parse tree generated for ReferenceToATNParser
pub trait ReferenceToATNParserContext<'input>: for<'x> Listenable<
dyn ReferenceToATNListener<'input> + 'x,
> + ParserRuleContext<'input, TF = LocalTokenFactory<'input>, Ctx = ReferenceToATNParserContextType>
pub trait ReferenceToATNParserContext<'input>: for<'x> Listenable<dyn ReferenceToATNListener<'input> + 'x>
+ ParserRuleContext<'input, TF = LocalTokenFactory<'input>, Ctx = ReferenceToATNParserContextType>
{
}

Expand Down

0 comments on commit 2fb4aab

Please sign in to comment.