Fortran library for reading and writing S-expressions
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cases
cmake/pkg
tmp
.dir-locals.el
.gitignore
CMakeLists.txt
LICENSE.txt
README.md
sexptran.f90
sexptran_get_X.f90
sexptran_get_X_array.f90
sexptran_get_X_array2.f90
simplest_example.f90
test_sexptran.f90
tests.sh

README.md

SEXPTRAN

A Fortran 2008 library for reading, manipulating and writing S-expressions.

  • Represents S-expressions as a tree structure
  • Handles comments, quoted strings and escaped characters
  • Compatible with the OCaml Sexplib library
  • Written in modern Fortran style
  • Overloaded functions for concise construction of S-expressions (within Fortran bounds)
  • Conversion functions for logical, integer, allocatable character, singlea and double precision reals, integer and real arrays
  • Accessor function for record names
  • Reference-counted cells prevent memory leaks
  • Self-contained with no dependencies
  • Detailed syntax error reporting

Usage

See test_sexptran.f90 and simplest_example.f90 for two usage examples.

Requirements

A good Fortran compiler and CMake.

Compilation and installation

mkdir build
cd build
cmake ..
make
sudo make install

For gfortran:

cmake .. -DCMAKE_Fortran_COMPILER=/usr/bin/gfotran-7

NOTE: gfortran 6 produces spurious warnings such as:

Warning: Only array FINAL procedures declared for derived type ‘out_channel’ defined at (1), suggest also scalar one [-Wsurprising]

For Intel (tested with ifort 18):

cmake .. -DCMAKE_Fortran_COMPILER=/opt/intel/bin/ifort

For PGI:

cmake .. -DCMAKE_Fortran_COMPILER=/opt/pgi/linux86-64/2017/bin/pgf90

NOTE: SEXPTRAN doesn't work with PGI compiler 17.4. The "select type" construct seems to be broken, the dynamic type of objects is lost.

Limitations

  • Multi-line comments not implemented yet
  • No cycle detection
  • Output to formatted units not supported

License

Placed under the MIT license.

Author

Oğuz Berke Antoine DURAK berke.durak@gmail.com