Language - (Grammar|Production) Rule

> Code - (Programming|Computer) Language > Computer Language - (Compiler|Interpreter) - Language translator

1 - About

Recursive rules (known as production):

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

Expression are not production rules. See Language - Expression


3 - Syntax

Production rules are simple replacements. For example, the rule

A -> a

replaces A with a.

There can be multiple replacement rules for any given value. For example,

A -> a
A -> b

means that A can be replaced with either:

  • a
  • or b.

4 - Type

Parsing Steps:

  1. Antlr - Lexer Rule (Token names): The lexer creates tokens from the lexer rule.
  2. Antlr - Parser Rule: Then, the parser creates an AST from the created tokens with the definition of parser rule.

5 - Documentation / Reference

code/compiler/rule.txt ยท Last modified: 2017/09/17 19:08 by