add support for include in datalog scanner #2270
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this change is an attempt to liberate ourselves from the dependency on a C preprocessor to read datalog programs.
The C preprocessor provides the following capabilities that I want to have natively in the datalog grammar:
#include
,#pragma once
,__FILE__
and__LINE__
. I believe it is sane to avoid supporting any form of preprocessor-flavored macro natively.This change introduces:
souffle
command-line option--no-preprocessor
that instructs Soufflé to scan directly from the input file..include "path"
..once
(scanner will skip the rest of the current file the next time it encounters this directive at the same location).__FILE__
and__LINE__
(replaced respectively with current file and line).The new directives are always handled, regardless of
--no-preprocessor
.Regardless of
--no-preprocessor
, the include stack is maintained at all time and all source locations now points to immutable objects of theIncludeStack
(instead of copies of vector of files). This allows to provide more precise error messages in the future by showing precise include stack for any source location.Regardless of
--no-preprocessor
, the support of C preprocessor output#line
and#
information is also updated to track the include stack.Current limitation: if a C preprocessor is used, only the main source file is pre-processed, files that are included with
.include
will not be pre-processed.