Package com.singularsys.extensions.structure

Provides limited support for block style programming with for, if and while statements.

The structure package provides limited support for block style programming with if, for and while statements. The exact syntax can be configurable to give a Java, Pascal or Basic like syntax. It is not intended to be a fully featured parser more a way to add some structured programming elements like simple loops to Jep code.

The StandardStructuredParser provides a ready made parser with a java-like syntax. It supports:

  • Statements separated by semi-colons x=5; y=x^2;
  • Blocks enclosed in curly-brackets { x=5; y=6; }
  • If statements if(x==5) {y=6;} else {y=7;}
  • For statements for(j=0;j<=10;++j) x+=j;
  • While statements while(x<10) x+=2;
  • Break and continue statements inside looks.

Alternative syntaxes can be built up using the StructuredGrammerParser and a set of GrammaticalRuleI. Rules are provided for most types of statements.

The StructuredEvaluator is used to evaluate sequences of expressions after parsing.

Since:
Jep 3.5 / Extensions 2.0
See Also:
StructuredConsole, Documentation