Sha256: 7ab9d8711772b2d21a1c10e60266585e346181fd2c6bd0093e2de37b618e369f

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

require_relative 'grm_symbol' # Load superclass

module Rley # This module is used as a namespace
  module Syntax # This module is used as a namespace
    # A non-terminal symbol (sometimes called a syntactic variable) represents
    # a composition of terminal or non-terminal symbols
    class NonTerminal < GrmSymbol
    
      # Constructor.
      # @param aName [String] The name of the grammar symbol.
      def initialize(aName)
        super(aName)
      end
      
      public
      
      # @return [false/true] Return true if the symbol derives
      # the empty string. As non-terminal symbol is nullable when it can
      # can match to zero input token.
      # The "nullability" of a non-terminal can practically be determined once
      # all the production rules of the grammar are specified.
      def nullable?()
        return @nullable
      end
      
      # Set the nullable flag.
      # @param aBoolean [true/false]
      def nullable=(aBoolean)
        @nullable = aBoolean
      end
      

    end # class
  end # module
end # module
# End of file

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rley-0.0.17 lib/rley/syntax/non_terminal.rb
rley-0.0.16 lib/rley/syntax/non_terminal.rb
rley-0.0.15 lib/rley/syntax/non_terminal.rb
rley-0.0.14 lib/rley/syntax/non_terminal.rb
rley-0.0.13 lib/rley/syntax/non_terminal.rb
rley-0.0.12 lib/rley/syntax/non_terminal.rb