Language - (Grammar|Production) Rule



Recursive rules (known as production):

Each production rule references others and thus makes up the grammar of the language.

Each rule is either matched or not so every rule expression is a boolean expression:

  • True means some part of an input sequence is matched,
  • False means nothing is matched even if some part of the input was matched.


See rule expression

Production are rules for replacing (or rewriting) nonterminal symbols (on the left side of the production) in a string with other nonterminal or terminal symbols (on the right side of the production).


Parsing Steps:

  1. Antlr - Parser Rule: Then, the parser creates an AST from the created tokens with the definition of parser rule.

Documentation / Reference

Discover More
Card Puncher Data Processing
Antlr - (Lexical) Rule

in Antlr. Antlr has two types of rule: Name Case Type Description Example from the getting started uppercase letter lexer rule (known as Token name, they defines the token that the lexer...
Card Puncher Data Processing
Code - Grammar / Syntax (Lexical)

This section regroups the entity of a computer language from a lexical point of view. It's the same as Parts of the speech for a natural language. Grammars are useful models when designing software...
Compiler - LL parser

An LL(k) parser is a type of parser that build the tree in a top-down way. LR approach It is a top-down parser that parses from left to right, constructs a leftmost derivation of the input ...
Compiler - Lexer rule (Token names, Lexical rule, Token name)

lexer rule are rules written specifically for the lexer as they defines tokens The lexer creates token from the input text that match this rules. A lexer rule is also known as: lexical rule token...
Compiler - Parser Rule

A parser rule is a rule that defines the structure of the parse tree. The parser uses them to build the parse tree. lexer rulestokenstree Parser rule names always start with a lowercase letter (...
Grammar - Rule Construct / Basic Rule Expression

This page lists common rule expression in order to describe the structure of the parsed document. A rule expression is a pattern expression that produces a boolean and are therefore predicate. grammar...
Javascript - Statement

An expression produces a value whereas a statement will not. All statements in JavaScript must end with a semi-colon, to indicate that this is where the statement ends. The parser may add semicolon...
Grammar Graphic Representation
Language - (Syntax|Structural) Tree

The graphical representations of a grammar are called Syntax or Structural tree. Whether your language input is (Markdown, HTML, or prose, ..), it needs to be parsed to a workable format. Such a format...
Language - Compiler compilers or (lexer|parser) generators

Compiler-compilers splits the work into a lexer and a parser: The Lexer reads text data (file, string,...) and divides it into tokens using lexer rule (patterns). It generates as output a list of tokens...
Language - Context Free Grammar (CFG)

A context-free grammar is: a set of instructions called grammar rules (known as production rules or production) that describe all possible strings in a given formal language without context ...

Share this page:
Follow us:
Task Runner