Create array from phrase using Pascal

In the shell one can do:
Code:
print -n "Enter volume groups: "
read vg_args
set -A VG $(echo ${vg_args[@]})
numVG=${#VG[@]}

How is that accomplished in Pascal?
 
Pascal? Seriously? Is there still somebody who uses that? I mean it was already out of fashion when I was in school. And that was 20+ years ago :q
 
SirDice said:
Is there still somebody who uses that?
Pascal is still widely used as a source language in teaching compiler building (although admittedly that probably isn't particularly relevant in this case). And if my memory serves me well, variants of Pascal are still used in the Delphi world.
 
gpatrick said:
How is that accomplished in Pascal?
I imagine that one way to do this would be to make one pass over the input string in order to count how many words there are, then allocate an array with that many elements and finally making a second pass over the input string to copy the words into the array you just allocated. Is it pretty? No. But it's the only thing I can think of right now and admittedly my Pascal is rather rusty.
 
fonz said:
Pascal is still widely used as a source language in teaching compiler building (although admittedly that probably isn't particularly relevant in this case). And if my memory serves me well, variants of Pascal are still used in the Delphi world.

It was used in teaching when I was in the university studying compilers and formal languages around 1997-1998. It has been replaced with Java now. The other language that seems to be used is Python.
 
SirDice said:
Pascal? Seriously? Is there still somebody who uses that? I mean it was already out of fashion when I was in school. And that was 20+ years ago :q

The Windows Skype client UI is written in Objective Pascal.
 
kpa said:
It was used in teaching when I was in the university studying compilers and formal languages around 1997-1998.
Same here, although maybe five years or so later.

kpa said:
It has been replaced with Java now. The other language that seems to be used is Python.
Rest assured plenty of compiler building courses nowadays still use Pascal. And given how well-structured it is, I can't say it surprises me. But yes, Python is also a good choice and probably more interesting for students because it's a language that is actively being used today. But I digress...
 
Back
Top