Sha256: 9f3f943d89bebe7c68a279b2a6eebbfa1dfcff7611da63ff34cd8aa145ffb2b7

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative 'grm_symbol'

module Dendroid
  module Syntax
    # A non-terminal symbol (sometimes called a syntactic variable) represents
    # a composition of terminal or non-terminal symbols
    class NonTerminal < GrmSymbol
      # @return [Boolean] true if symbol can derive the null token
      attr_accessor :nullable

      # @return [Boolean] true iff the symbol always matches a non-empty
      #   sequence of terminal symbols
      attr_accessor :productive

      # Predicate method to check whether the symbol is a terminal symbol.
      # @return [FalseClass]
      def terminal?
        false
      end

      # Predicate method to check whether the symbol can derive (match)
      # the null token.
      # @return [Boolean]
      def nullable?
        @nullable
      end

      # Predicate method to check whether the symbol always matches
      # a non-empty sequence of terminal symbols.
      # @return [Boolean]
      def productive?
        @productive
      end
    end # class
  end # module
end # module

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dendroid-0.2.04 lib/dendroid/syntax/non_terminal.rb
dendroid-0.2.03 lib/dendroid/syntax/non_terminal.rb
dendroid-0.2.02 lib/dendroid/syntax/non_terminal.rb
dendroid-0.2.01 lib/dendroid/syntax/non_terminal.rb
dendroid-0.2.00 lib/dendroid/syntax/non_terminal.rb
dendroid-0.1.00 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.12 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.11 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.10 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.9 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.8 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.7 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.6 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.5 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.4 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.3 lib/dendroid/syntax/non_terminal.rb
dendroid-0.0.2 lib/dendroid/syntax/non_terminal.rb