ParCinJ logo

Fluent Interface API

provides 6 methods to create EBNF graphs. Each method turns the symbol (terminal or non-terminal) into a more complex non-terminal symbol.

followedBy(Symbol symbol)
It creates a sequence of two symbols.

Example:

  Symbol newSymbol = symbol1.followedBy(symbol2).followedBy(symbol3);
newSymbol realizes the following graph:

Sequence of symbols

It is an instance of

or(Symbol symbol)
It creates an alternative of two symbols.

Example:

  Symbol newSymbol = symbol1.or(symbol2).or(symbol3);
newSymbol realizes the following graph:

Alternative of symbols

It is an instance of

optional()
It creates a kind of alternative where the symbol occurs or not.

Example:

  Symbol newSymbol = symbol.optional();
newSymbol realizes the following graph:

Optional symbol

It is an instance of

zeroOrMoreTimes()
It creates a sequence where the symbol occurs zero or more times.

Example:

  Symbol newSymbol = symbol.zeroOrMoreTimes();
newSymbol realizes the following graph:

Zero or more times the same symbol

It is an instance of

oneOrMoreTimes()
It creates a sequence where the symbol occurs one or more times.

Example:

  Symbol newSymbol = symbol.oneOrMoreTimes();
newSymbol realizes the following graph:

One or more times the same symbol

It is an instance of

zeroOrMoreTimesSeparatedBy(Symbol delimiter)
It creates a sequence where the symbol occurs zero or more times. Between to successive symbols a delimiter symbol has to occur.

Example:

  Symbol newSymbol = symbol.zeroOrMoreTimesSeparatedBy(delimiter);
newSymbol realizes the following graph:

Zero or more times the same symbol with a delimiter symbol in between

It is an instance of