Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the preferred Pascal file extension?

Tags:

file

pascal

Is it:

  • .p
  • .pl
  • .pas
  • .pascal

Or something else?

And will the various Pascal compilers (notably fpc) bork if you don't use the preferred extension?

like image 781
mcandre Avatar asked Oct 14 '11 04:10

mcandre


People also ask

Whats a .pas file?

What is a PAS file? A . pas file is actually a Source code file which can be found in a Delphi programming project. The Delphi is a software development application used by developers for building Windows based softwares; written in the Delphi language. The Delphi language is a variant of the Object Pascal language.

Is Pascal still in use?

Developed in the late 1960s, Pascal is an imperative and procedural programming language that was originally designed for teaching programming languages. Today, it's been mostly replaced by C, C++ and Java, but it's still used as an introduction to programming.

How do I read a Pascal file?

So, to read out all text file is just like this : uses crt; var F : text; s : string; begin clrscr; write('Input file name to read : '); readln(s); assign(F,s); { associate it } reset(F); { open it } while not EOF(F) do { read it until it's done } begin readln(F,s); writeln(s); end; close(F); { close it } end.


2 Answers

The most common file extension for Pascal is pas. As for FPC, it uses the pp extension to denote FPC-specific code.

I think there is not a "preferred" extension, but you can't miss by using pas.

like image 183
Petr Abdulin Avatar answered Sep 28 '22 08:09

Petr Abdulin


.pl is a bad idea, because it will conflict with both perl and prolog programs.

According to the Wikipedia .pp, .pas, .inc are valid (last one for include files).

You may also check FreePascal Wiki, which describe .pas as

Unit with Pascal code (typically for a form stored in a corresponding *.lfm file)

and .pp as

Pascal code

I believe you should use one of these two depending of your own preferences.

like image 31
radrow Avatar answered Sep 28 '22 08:09

radrow