Pages

Monday, May 22, 2017

PreForM

"A very simple and stupid preprocessor for modern Fortran projects.

PreForM.py supports the most used cpp pre-processing directives and provides advanced features typical of templating systems. Even if PreForM.py is currently Fortran-agnostic (it being usable within any programming languages) it is focused on Fortran programming language.

The features are:

  • Easy-extensible: PreForM.py is just a less-than 500 lines of Python statements... no bad for a poor-cpp-preprocessor improvement;


  • well integrated with a powerful yet simple automatic Building System for Fortran poor-men, namely FoBiS.py;
  • simple command line interface;
  • support the most used cpp pre-processing directives:
    • conditionals:
      • operators (also nested):
        • defined MACRO or defined(MACRO);
        • EXPRESSION || EXPRESSION (logic or);
        • EXPRESSION && EXPRESSION (logic and);
      • #if EXPRESSION;
      • #elif EXPRESSION;
      • #ifdef MACRO;
      • #ifndef MACRO;
      • #else;
      • #endif;
    • macros:
      • standard predefined macros:
        • __FILE__;
        • __LINE__;
        • __DATE__;
        • __TIME__;
      • expansion;
      • stringification;
      • concatenation;
      • variadic macros;
      • object-like macros:
        • #define MACRO [VALUE], VALUE is optional;
      • function-like macros:
        • #define FUNCTION FUNCTION_DEFINITION;
      • #undef;
    • #include;
  • pythonic Template System:
    • #PFM for EXPRESSION-#PFM endfor pairs loop control (only for one iteration counter at time
    Note that in general the cpp pre-processing directives should start at the first column, the symbol # being the first one. PreForM.py relaxes this rule allowing any number of leading white spaces before #.

    https://github.com/szaghi/PreForM 
  • No comments:

    Post a Comment