gthd / pawk

A parallel awk-like language
Apache License 2.0
4 stars 1 forks source link

Handle print statements in non BEGIN/END blocks #15

Closed dspinellis closed 3 years ago

dspinellis commented 4 years ago

They should be either prohibited, or, better, their outpout should be stored in memory or in temporary files and then serialized.

gthd commented 4 years ago

Hi @dspinellis, can you please provide me with such an example to test against.

dspinellis commented 4 years ago

Trivial implementation

awk '{print}' should fail with an error, while awk 'BEGIN{print "hello "} END {print "world"}' /dev/null should succeed printing hello world.

More sophisticated implementation

seq 1 10000 | awk '{print}' should output the same as seq 1 10000.

gthd commented 4 years ago

Since print is not parallelizable, shouldn't we restrict its use inside the action statement ?

dspinellis commented 4 years ago

This is the trivial implementation. The more sophisticated one involves storing its output and serializing it at the end of the program's operation.

gthd commented 4 years ago

I have implemented the trivial solution so far.