Inherits from NSObject
Conforms to NSCoding
Declared in CPGrammarSymbol.h
CPGrammarSymbol.m

Overview

The CPGrammarSymbol class represents a terminal or nonterminal grammar symbol.

All grammar symbols carry a name which is used in constructing CPRules.

Tasks

Creating and Initialising a Rule

Configuring a Rule

Properties

name

The grammar symbol’s name.

@property (readwrite, copy) NSString *name

Discussion

The grammar symbol’s name.

Declared In

CPGrammarSymbol.h

terminal

Whether the grammar symbol is a terminal or non-terminal.

@property (readwrite, assign, getter=isTerminal) BOOL terminal

Discussion

Whether the grammar symbol is a terminal or non-terminal.

Declared In

CPGrammarSymbol.h

Class Methods

nonTerminalWithName:

Creates a nonterminal grammar symbol.

+ (id)nonTerminalWithName:(NSString *)name

Parameters

name

The nonterminal name.

Return Value

Returns a nonterminal CPGrammarSymbol with the specified name.

Discussion

Creates a nonterminal grammar symbol.

Declared In

CPGrammarSymbol.h

terminalWithName:

Creates a terminal grammar symbol.

+ (id)terminalWithName:(NSString *)name

Parameters

name

The terminal name.

Return Value

Returns a terminal CPGrammarSymbol with the specified name.

Discussion

Creates a terminal grammar symbol.

Declared In

CPGrammarSymbol.h

Instance Methods

initWithName:isTerminal:

Initialises a grammar symbol.

- (id)initWithName:(NSString *)name isTerminal:(BOOL)terminal

Parameters

name

The nonterminal name.

terminal

Specifies whether the grammar symbol is a terminal or nonterminal.

Return Value

Returns a CPGrammarSymbol with the specified name.

Discussion

Initialises a grammar symbol.

Declared In

CPGrammarSymbol.h

isEqualToGrammarSymbol:

Determines whether the grammar symbol is equal to another.

- (BOOL)isEqualToGrammarSymbol:(CPGrammarSymbol *)object

Parameters

object

The other grammar symbol to compare.

Return Value

Whether the two symbols are equal.

Discussion

Determines whether the grammar symbol is equal to another.

Declared In

CPGrammarSymbol.h