[ Reference Manual | Alphabetic Index ]


Configure ECLiPSe parser to accept FlatZinc syntax   [more]


read_item(?, ?)
No description available


This module provides a quick way to enable ECLiPSe to read FlatZinc items. FlatZinc Syntax is sufficiently close to ECLiPSe syntax to allow the normal ECLiPSe parser to read FlatZinc, provided a number of syntax options are set. The way to use this library is to load it

:- lib(flatzinc_syntax).
and then use the normal read/1,2,etc primitives with this module context, e.g.
..., read(Stream, FlatZincItem)@flatzinc_syntax, ...
for example
fzn_echo(File) :-
	open(File, read, Stream),
	read(Stream, Term1)@flatzinc_syntax,
	( fromto(Term1, Term, Term2, end_of_file), param(Stream) do
	    read(Stream, Term2)@flatzinc_syntax

Alternatively, the library exports read_item/2, which is defined as

read_item(Stream, Term) :-
	read(Stream, Term)@flatzinc_syntax,
	Term \== end_of_file.
and is call-compatible with the predicate of the same name exported from lib(flatzinc_parser), but faster. Since it works simply by modifying syntax settings for the normal ECLiPSe parser, it is less strict than the purpose written library(flatzinc_parser), and will detect less syntax errors. This should however not be an issue when processing generated FlatZinc source.


See Also

Generated from flatzinc_syntax.eci on 2022-04-24 18:55