Questions tagged [pascal]

Pascal is an imperative language from the Wirthian family created in 1969. It was widely used in engineering and teaching in the 1970s and 1980s. It lives on in compilers as Free Pascal and Delphi.

Pascal is an influential imperative and procedural programming language, designed in 1969 and published in 1970 by Niklaus Wirth as a small and efficient language. It was largely (but not exclusively) intended to teach students structured programming and data structuring.

Pascal is a descendant of , but it was implemented on a wide range of architectures, from PDP-11s, IBM PCs, to CDC Cyber and IBM System 370 mainframes. Pascal probably reached critical mass around the time Borland released Turbo Pascal in 1983.

Wirth later developed Modula-2 and Oberon and those languages share much of Pascal's design. Other derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal).

Pascal is a purely procedural language and includes control statements with reserved words such as if, then, else, while, for, and so on. However, Pascal also has many data structuring facilities and other abstractions not included in ALGOL 60 like type definitions, records, pointers, enumerations, and sets.

External Resources

Free Pascal/Delphi Programming Books

2598 questions
7
votes
4 answers

Delphi - find character a given position/index

I have searched all over for this. In Delphi/Lazarus, given a position, I want to find the character at that position in a different string. I know how to find the position of a character. I need it the other way around: the character at a given…
preahkumpii
  • 1,301
  • 4
  • 21
  • 36
7
votes
2 answers

Crenshaw's "Let's Build a Compiler": Transcription to C and x86 Assembler?

I am trying to work through Jack Crenshaw's excellent compiler programming tutorial "Let's Build a Compiler" and have bumped into two hurdles. First the code is written in Pascal, a great language for which I have both respect and fondness from a…
haziz
  • 12,994
  • 16
  • 54
  • 75
7
votes
1 answer

How did Turbo Pascal overlays work?

I'm implementing an assemblinker for the 16-bit DCPU from the game 0x10c. One technique that somebody suggested to me was using "overlays, like in Turbo Pascal back in the day" in order to swap code around at run time. I get the basic idea (link…
Aubrey Jones
  • 123
  • 6
7
votes
6 answers

Delphi: How to find and fix an EOutOfMemory Error?

I'm building a delphi application which does scientific simulation. It's growing in complexity & now consists of many units and forms. I'm starting to get EOutOFMemory Errors each time I run. It seems to happen during or just after I use an Array…
Hamish_Fernsby
  • 558
  • 1
  • 7
  • 28
6
votes
4 answers

How operate on TFileStream

Hello recently I replace TextFile with TFileStream. I never use it so I have small problem with it. How can I add someting to my file after I assign it to variable? How can I read someting form that file? I need defined line form that file so I…
Błażej
  • 3,617
  • 7
  • 35
  • 62
6
votes
2 answers

Why do I/O errors fail to raise exceptions?

I'm using old style Pascal I/O routines and expect that calls to I/O functions that fail should raise an EInOutError. When I try this I do not see an exception raised and I have no clue why. procedure TForm1.Button1Click(Sender: TObject); //var i:…
Błażej
  • 3,617
  • 7
  • 35
  • 62
6
votes
2 answers

True C static local variable replacement?

just trying to achieve similar functionality of C/C++ static local variables in ObjectPascal/Delphi. Let's have a following function in C: bool update_position(int x, int y) { static int dx = pow(-1.0, rand() % 2); static int dy = pow(-1.0,…
David Unric
  • 7,421
  • 1
  • 37
  • 65
6
votes
3 answers

Translating Languages In Delphi

I have been looking for ages now for some code that can translate any language to another but none of the code I find works. I know Google has a good translate API but I can't get anyone's Delphi code on it to work. There is always an error that…
Michael McQuirk
  • 113
  • 1
  • 7
6
votes
2 answers

My Pascal program is warning me about unreachable code

Why is pascal giving me unreachable code in line (8,21) and (8,12). I don't know why its a simple code for making an octal number of 3 digits to decimal. The program is ok because is giving me the right result, but I don't know why free pascal is…
6
votes
5 answers

Java/C/C++/C#/PHP to Pascal converter?

Does anyone know if there is a Java/C/C++/C#/PHP to Pascal converter?
ThatJoeGuy
  • 121
  • 1
  • 2
  • 5
6
votes
7 answers

Need code for Inverse Error Function

Does anyone know where I could find code for the "Inverse Error Function?" Freepascal/Delphi would be preferable but C/C++ would be fine too. The TMath/DMath library did not have it :(
Mike Furlender
  • 3,869
  • 5
  • 47
  • 75
6
votes
4 answers

Programming CUDA using Delphi or FreePascal

Can I create CUDA/OpenCL applications using Delphi or FreePascal? Or am I forced to use C++ and Visual Studio? A quick search: cuda + pascal Turns up some promising leads, but none of them seem to work out, what options do I have if I want to fire…
Johan
  • 74,508
  • 24
  • 191
  • 319
6
votes
3 answers

How do I Invoke a procedure when inside another procedure in Pascal

procedure questiontype; begin writeln ('Enter the type of question you would like...'); writeln ('1. Add'); writeln ('2. Multiply'); writeln ('3. Subtraction'); writeln ('4. Division'); readln (typeofquestion); case…
captiv
  • 107
  • 2
  • 9
6
votes
3 answers

Bootable and cross platform applications and using delphi or Pascal

Is it Possible to create bootable (Applications for MBR )application using Delphi or Pascal (I know we cant use vcl , RTL and other stuffs because they depend on OS), but can i use at least Readln and writeln. If it is true !!! Can we run the…
Vibeeshan Mahadeva
  • 7,147
  • 8
  • 52
  • 102
6
votes
2 answers

C function pointer translation into Delphi/Pascal?

I am currently translating some C headers into Delphi. I am unable find a reference for converting a function pointer from C into Delphi. typedef _JAlloc JAlloc; struct _JAlloc { void *(*alloc) (JAlloc *allocator, size_t size); void…
Ramnish
  • 322
  • 3
  • 12