[fpc-pascal] Any command line interpreters for Free Pascal?

Andrew Pennebaker andrew.pennebaker at gmail.com
Sun Oct 16 19:53:24 CEST 2011

There are plenty who do believe it's convenient to hide compilation in the
background--the users of instantfpc. Syntax for shebangs in fpc would bridge
instantfpc and traditional Pascal code. You would no longer have to treat
instantfpc code as a special case, because fpc wouldn't mind the shebangs.

It's the same for case statements and if statements. If you really prefer if
statements for everything, you can write everything with if statements. But
for those who recognize the convenience of case statements, it's nice to
have case statements.

Adding shebangs would not change the nature of Pascal. It's first and
foremost a compiled, highly optimized language. Shebangs would allow Pascal
to better fill the Unix scripting niche.

I'm working on a patch, but when I compile fpc, the resulting binary appears
to completely ignore the new syntax, insisting that #! is the beginning of
an invalid character. Can anyone fix this?

if (c = '#') then
    if c = '!' then

          until (c = #10) or (c = #13);

$ cat hello.pas
#!/usr/bin/env instantfpc

program Hello;
writeln('Hello World!')

$ fpc hello.pas
hello.pas(1,1) Error: Illegal char constant
hello.pas(1,2) Fatal: Syntax error, "BEGIN" expected but "const string"


Andrew Pennebaker

On Sun, Oct 16, 2011 at 5:59 AM, Jonas Maebe <jonas.maebe at elis.ugent.be>wrote:

> On 16 Oct 2011, at 11:42, J├╝rgen Hestermann wrote:
> > But hiding away the compilation step from the user does not turn a
> compiler language into an interpreter language. There is no benefit in doing
> so. You can simply compile your programs and then use the executable in your
> scripts. Where is the problem?
> There is no "problem". It's simply a matter of convenience. You may not
> think it to be more convenient to edit source code and then "run" it without
> an explicit compilation step in between, but other people obviously do.
> Trying to convince other people that there is no benefit or trying to make
> them convince you that there is a benefit is unlikely to lead anywhere.
> That said, adding a hack to the compiler to ignore a she-bang if it appears
> at the start of a source file is extremely unlikely to ever happen (and I'm
> personally not inclined to accept such patches). As Mattias mentioned, if
> you want to compile such source code you can use instantfpc itself to
> compile the binary.
> Jonas_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111016/230c1715/attachment.html>

More information about the fpc-pascal mailing list