[ Reference Manual | Alphabetic Index ]

library(flatzinc_syntax)

Configure ECLiPSe parser to accept FlatZinc syntax   [more]

Predicates

read_item(?, ?)
No description available

Description

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
	    writeln(Term),
	    read(Stream, Term2)@flatzinc_syntax
	),
	close(Stream).

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.

About

See Also

library(flatzinc_parser)
Generated from flatzinc_syntax.eci on 2022-09-03 14:26