[][src]Attribute Macro gll_pg_macros::gll

#[gll]

The macro to generate a GLL parser.

It should be used on a impl block with a lexer:

use gll_pg_core::*;
use gll_pg_macros::gll;

struct Parser {}
#[gll(S, Token)]
impl Parser {
    // ...
    #[rule(S -> Ta)]
    fn rule1(a: LogosToken<Token>) -> () { }
}

Here S is the start symbol and Token is a lexer deriving Logos.

Each rule is of form lhs -> rhs1 rhs2 .... If you want to express lhs -> Eps rule, use lhs -> .

In each method, you can use &self, &mut self or simply omit it.

A type is associated with each rhs and return type is associated with lhs. Every terminal uses LogosToken<Token> type. Each nonterminal uses one custom type which derives Clone through out the grammar.

The generated Parser::parse function has the same return type as start symbol.