Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29001 Discussions

Fixed source form's most vexing parse?

IanH
Honored Contributor III
1,069 Views
For a bit of a giggle I've been writing a bit of a Fortran "parser" (whatever that is) in ... Fortran! Getting fixed source form to work has not been fun. Some pathological examples came to mind, which also cause ifort 12.0.4 some grief:

[fxfortran]C23456
C The following is a type-declaration-stmt for an array that is also 
C the first statement of a main program.  It is not a function-stmt,
C but the compiler could perhaps be forgiven for thinking so...
      INTEGER Elemental Function Name(10)
C Body of program just for fun.
      ElementalFunctionName = [(i,i=1,SIZE(ElementalFunctionName))]
      PRINT "(10(I0,:,','))", ElementalFunctionName
      END
[/fxfortran]

[plain]>ifort silly_var_name.for
Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.4.196 Build 20110427
Copyright (C) 1985-2011 Intel Corporation.  All rights reserved.

silly_var_name.for(5): error #5082: Syntax error, found INTEGER_CONSTANT '10' when expecting one of: ) 
      INTEGER Elemental Function Name(10)
--------------------------------------^
compilation aborted for silly_var_name.for (code 1)[/plain]
0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,069 Views
Now I've seen everything - a Fortran parser in Fortran?!

Very amusing example - thanks. Escalated as DPD200170271.
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,069 Views
>>Now I've seen everything - a Fortran parser in Fortran?!

Circa 1980 there was acompany producing a word processor software package for the PDP-11 writtenin FORTRAN called MAS90 (I do not know if this is the same company with the currentaccounting package named MAS90). Writing a word processor in FORTRAN was rather weird.

Jim Dempsey
0 Kudos
jparsly1
New Contributor I
1,069 Views
back in college days, we were using a breadboard computer kit in a class whose focus
was creating code to interface with hardware. Stuff like making music come out of a speaker or
setting up an led display. You were expected write assembly langauge code and convert it into
machine code by hand.

I had a DEC system 10 account for another class, so I wrote an assembler in Fortran, to convert
my code. About the only time I ever needed to use Z format.
0 Kudos
Steven_L_Intel1
Employee
1,069 Views
Well, I've seen an OS written in Fortran (PRIMOS), but with lots of extensions.
0 Kudos
martin_upsdellagrese
1,069 Views
It is not that silly. The Burroughs Algol lanaguage was written in Burroughs Algol. They had towrite the first generation which had only a few statements by hand but after that could use the compilergenerated to write the next bits. They found that the compiler generatedsmaller code than their initial hand written one.
0 Kudos
Steven_L_Intel1
Employee
1,069 Views

This has been fixed for a release later this year.

0 Kudos
Reply