Ruud Ruizenaar
Ruud Ruizenaar

Reputation: 1

Pico demo fails with syntax highlighting and syntax checking

I am experimenting with DSL and wanted to give a try with Rascal. After installation of Eclipse (oxygen) and Rascal plugin I was able to play around with Rascal code snippets.

When trying to play with the Pico language I have few problems for which I cannot find a proper solution. Maybe somebody has some ideas.

issue 1: when using the example text (below) copied from the rascal website (to me this sounds proper Pico code). It gives an error directly after the last closing end. Removing code from the while do block results an error free

begin declare input : natural,
output : natural,
repnr : natural, rep : natural; input := 14; output := 1; while input - 1 do
rep := output; repnr := input; while repnr - 1 do output := output + rep; repnr := repnr - 1 od; input := input - 1 od end

issue 2: with proper pico code there is no syntax highlighting shown; all black code.

Has anybody encountered this before and if so have a solution?

Upvotes: 0

Views: 194

Answers (1)

Jurgen Vinju
Jurgen Vinju

Reputation: 6696

It would help if you put some URLs or source code examples of what you are trying to run.

I've tried the code at http://tutor.rascal-mpl.org/Recipes/Basic/Basic.html#/Recipes/Languages/Pico/Syntax/Syntax.html and parsed this with it: http://tutor.rascal-mpl.org/Recipes/Basic/Basic.html#/Recipes/Languages/Pico/Pico.html using this:

rascal>parse(#start[Program], readFile(|project://rascal-test-library/src/hello.pico|), |project://rascal-test-library/src/hello.pico|)
start[Program]: (start[Program]) `begin declare input : natural,  
              output : natural,           
              repnr : natural,
              rep : natural;
      input := 14;
      output := 1;
      while input - 1 do        
          rep := output;
          repnr := input;
          while repnr - 1 do
             output := output + rep;
             repnr := repnr - 1
          od;
          input := input - 1
      od
end`

So it seems to work for me. Could you show the code that you are running?

Upvotes: 0

Related Questions