Class: Dendroid::Syntax::NonTerminal

Inherits:
GrmSymbol
  • Object
show all
Defined in:
lib/dendroid/syntax/non_terminal.rb

Overview

A non-terminal symbol (sometimes called a syntactic variable) represents a composition of terminal or non-terminal symbols

Instance Attribute Summary collapse

Attributes inherited from GrmSymbol

#name

Instance Method Summary collapse

Methods inherited from GrmSymbol

#==, #initialize, #to_s

Constructor Details

This class inherits a constructor from Dendroid::Syntax::GrmSymbol

Instance Attribute Details

#nullableBoolean

Returns true if symbol can derive the null token.

Returns:

  • (Boolean)

    true if symbol can derive the null token



11
12
13
# File 'lib/dendroid/syntax/non_terminal.rb', line 11

def nullable
  @nullable
end

#productiveBoolean

Returns true iff the symbol always matches a non-empty sequence of terminal symbols.

Returns:

  • (Boolean)

    true iff the symbol always matches a non-empty sequence of terminal symbols



15
16
17
# File 'lib/dendroid/syntax/non_terminal.rb', line 15

def productive
  @productive
end

Instance Method Details

#nullable?Boolean

Predicate method to check whether the symbol can derive (match) the null token.

Returns:

  • (Boolean)


26
27
28
# File 'lib/dendroid/syntax/non_terminal.rb', line 26

def nullable?
  @nullable
end

#productive?Boolean

Predicate method to check whether the symbol always matches a non-empty sequence of terminal symbols.

Returns:

  • (Boolean)


33
34
35
# File 'lib/dendroid/syntax/non_terminal.rb', line 33

def productive?
  @productive
end

#terminal?FalseClass

Predicate method to check whether the symbol is a terminal symbol.

Returns:

  • (FalseClass)


19
20
21
# File 'lib/dendroid/syntax/non_terminal.rb', line 19

def terminal?
  false
end