Skip to content

Expression block ... and more

Reinhard Budde edited this page Apr 16, 2019 · 1 revision

preconditions: Java, Javascript; experience with parser (generators) very useful

context: OpenRoberta is a learning platform. It uses a graphical programming language (based on blockly) and has code generators/loader for many robots and embedded systems used in education. Browse through https:lab.open-roberta.org . Use the simulator and write some simple programs

problem: some constructs are hard to design with graphical programming languages, for instance an expression as "1+4*5". Users have mentally to construct a parse tree ("+" at the top, ...). One can argue, that this a valuable experience in constructing trees, and understanding trees is valuable by itself. But to move 5 blocks is nevertheless boring to do.

task 1: create a expression block, i.e. new block with a text field, that contains the textual representation of an expression.

  • Select a parser generator (antlr4 is a good choice, but it depends on you),
  • write a grammar to parse the expression,
  • rules to construct the abstract syntax tree (AST) used in OpenRoberta
  • add code to the various AST-visitors to check the block for consistency, to generate code, ...

task 2: extend the grammar to parse a textual representation of the complete graphical language NEPO. This includes an investigation into concrete syntax (doing it the Java-way or the Python-way :-) and must take into account the target group of OpenRoberta. It is conceivable to design more than one concrete syntax' and allow the user to select one and to convert between them.

contact: reinhard.budde AT iais.fraunhofer.de

Clone this wiki locally