This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Translating gfortran's parser to Fortran


As an old Fortran programmer with an interest in programming language implementations, I am interested in translating part of gfortran's front end to a subset of Fortran 2003. In doing so I hope to strengthen my very weak C skills, and learn more about the structure of compilers. This will be a very part time effort, and progress, if any, will be slow. If I make significant progress I plan to release the code to the gfortran team to do with as they will. At a minimum it should serve as a test of the compiler's ability to handle Fortran text processing code. However any release of my effort will require permission from my employer though I plan to do my work on my own time, and I do not plan to tackle its substantial bureaucracy until I see whether I can make substantial progress. Do members of gfortran's team have opinions about such a project and the postponement of permissions?

If the project is acceptable to the gfortran team, my plan was to first tackle gfortran.h in preparation for match.c, match.h, parse.c and parse.h. In translating the code the first two issues I would want to address are setting up a comment style, and deciding how to handle enums.

My plan was to retain most comments changing them to Fortran end of line comments, but perhaps adding attribution markings to distinguish them from any comments I add. Would you prefer attributions and if so what form. In particular the standard copyright boiler plate at the start of each file (example taken form gfortran.h)


/* gfortran header file Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Andy Vaught

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */


I would change to



! gfortran module file ! Copyright (C) 2009 ! William B. Clodius ! Based on gfortran.h ! Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 ! Free Software Foundation, Inc. ! Contributed by Andy Vaught

! This file is part of GCC.

! GCC is free software; you can redistribute it and/or modify it under
! the terms of the GNU General Public License as published by the Free
! Software Foundation; either version 3, or (at your option) any later
! version.

! GCC is distributed in the hope that it will be useful, but WITHOUT ANY
! WARRANTY; without even the implied warranty of MERCHANTABILITY or
! FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
! for more details.

! You should have received a copy of the GNU General Public License
! along with GCC; see the file COPYING3.  If not see
! <http://www.gnu.org/licenses/>.

perhaps also adding appropriate permissions from my employer. Is this reasonable?

As to enums at the moment I am inclined to use the C interoperability enumeration, but I am not happy with that choice. It is even less type safe than C's version of enumerations. Unfortunately the alternatives all seem to require hand coding in values, daunting given the mass of enums in gfortran.h, and the more type safe versions pose potential problems interfacing to other portions of the gcc library. Any suggestions



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]