Can we define non-context free grammar with ANTLR?

I'm new to ANTLR4, and now I'm trying to determine which grammars we can define with it.

As I understand it, there are two types of rules in ANTLR: parser rules (lowercase words) and lexer rules (uppercase words). Example:

grammar Test;

init: prog(','prog)*;

prog: A
     | prog
     ;

A: [a-z]+;

Formulate the point of the rule for creating grammar. I would say that the parser rules are NON-TERMINAL characters, which can be replaced by a sequence of tokens defined by lexer rules.

So, it is very clear that grammar is context-free definition . The alpabet of the language generated by the grammar consists of all words composed of a lowercase Latin letter.

: - ANTLR4?

+2
1

. ().

, . , "". , , ANTLR, (, , , ).

.

, , ANTLR, "". , - , "" ANTLR, , . ( ANTLR , , ..). "", LL (1), LALR (k) ...

?

, - . Earley CYK , , . GLR ( , [. ], , , . -, GLL , , , .

, , - , MetaS. , , , . , - ; , .

+3

Source: https://habr.com/ru/post/1675907/


All Articles