User Tools

Site Tools


compilers:sample-lab-exam

This is an old revision of the document!



Warning: Declaration of syntax_plugin_gallery::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /afs/elte.hu/user/d/deva/web/pubwiki/lib/plugins/gallery/syntax.php on line 17

Warning: Declaration of syntax_plugin_gallery::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /afs/elte.hu/user/d/deva/web/pubwiki/lib/plugins/gallery/syntax.php on line 17

Warning: Declaration of syntax_plugin_cellbg::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /afs/elte.hu/user/d/deva/web/pubwiki/lib/plugins/cellbg/syntax.php on line 0

Warning: Declaration of syntax_plugin_cellbg::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /afs/elte.hu/user/d/deva/web/pubwiki/lib/plugins/cellbg/syntax.php on line 0

Sample programming task

Change/extend the compiler of the While language as follows:

  • Grade 2: Change the definition of variable names (identifiers) so that they have to contain at least one digit.
  • Grade 3: Add the elsif keyword to the language. (1 point)
  • Grade 4: Change the syntax of branching so that it allows multiple branches: (1 point)
if x < 10 then
   a := 0;
elsif x = 0 then
   a := 1;
else
   a := 2;
end
  • Grade 5: Emit error message if the condition of an elsif is not boolean. (1 point)
compilers/sample-lab-exam.1481924712.txt.gz · Last modified: 2016/12/16 22:45 by deva