t-edson / PicPas

Compilador en Pascal para microcontroladores PIC / Pascal compiler for PIC microcontrollers
GNU General Public License v2.0
88 stars 27 forks source link

error on function implementation #22

Closed alexpseletr closed 6 years ago

alexpseletr commented 6 years ago

function adc_read(adc_chan:byte):word; begin end;

error : ":" or ", " expected.

t-edson commented 6 years ago

PicPas use the syntax of Modula-2 no standard Pascal . To declare functions, you use the same word PROCEDURE. So you declare a function:

procedure adc_read(adc_chan:byte):word;
begin
end;
alexpseletr commented 6 years ago

your solution worked only as a suggestion the project (http://www.pas2pic.hu/) that works only at command prompt accepts the expression function

t-edson commented 6 years ago

It's not a problem to implement the FUNCTION keyword. It's just PicPas bet on a modern Pascal syntax. The same is true for structures like IF, WHILE and FOR. There is "Pascal mode" in PicPas that will accept the classic Pascal syntax.