Previous Up Next

A.5  Changing the Parser behaviour

Some of these properties can be changed by choosing one of the following syntax_options. The following options exist:
bar_is_no_atom
disallow the use of an unquoted vertical bar as atom or functor (and turns it into a synonym for a semicolon instead).
based_bignums
Allow base notation even to write integers longer than the wordsize (this implies they are always positive because the most significant bit is not interpreted as a sign bit).
blanks_after_sign
ignore blank space between a sign and a number (by default, this space is significant and will lead to the sign being taken as prefix operator rather than the number's sign).
doubled_quote_is_quote
parse a pair of quotes within a quoted item as one occurrence of the quote within the string. If this option is off (the default), consecutive string-quoted and list-quoted items are parsed as a single (concatenated) item, and consecutive quoted atoms are parsed as consecutive atoms.
iso_escapes
ISO-Prolog compatible escape sequences within strings and atoms.
iso_base_prefix
allow binary, octal or hexadecimal numbers to be written with 0b, 0o or 0x prefix respectively, and disallow the base'number notation.
limit_arg_precedence
do not allow terms with a precedence higher than 999 as structure arguments, unless parenthesised.
nested_comments
allow bracketed comments to be nested.
nl_in_quotes
allow newlines to occur inside quotes.
no_array_subscripts
disallow the ECLiPSe specific array-subscript syntax.
no_attributes
disallow the ECLiPSe specific syntax for variable attributes in curly braces.
no_blanks
do not allow blanks between functor an opening parenthesis
no_curly_arguments
disallow the ECLiPSe specific syntax for structures with named arguments in curly braces.
read_floats_as_breals
read all floating point numbers as bounded reals rather than as floats. The resulting breal is a small interval enclosing the true value of the number in decimal notation.
var_functor_is_apply
allow variables as functors, and parse a term like X(A,B,C) as apply(X,[A,B,C]).
A number of further syntax options is provided for the purpose of parsing non-Prolog-like languages, in particular the Zinc family:
atom_subscripts
allow subscripts after atoms, and parse a term like a[B,C] as subscript(a,[B,C]).
general_subscripts
allow subscripts after atoms, parenthesized subterms and subscripted terms, and parse a term like a[B][C] as subscript(subscript(a,[B]),[C]), or (a-b)[C] as subscript(a-b,[C]).
curly_args_as_list
parse the arguments of a term in curly brackets as a list, i.e. parse {a,b,c} as {}([a,b,c]) instead of the default {}((a,b,c)).
Syntax option settings can be local to a module or exported, e.g.
:- local syntax_option(not nl_in_quotes).
:- export syntax_option(var_functor_is_apply).

Previous Up Next