The SYNTAX/FNC2 FAQ





Frequently Asked Questions / Forum Aux Questions

on the SYNTAX/FNC2


Version 1.19 - Date 99/05/18 18:03:09

This a collection of Frequently Asked Questions (FAQ) and BUGS asked by the VASY users of SYNTAX/FNC2 over the years. This FAQ was created in 1998 by Mihaela Sighireanu on the base ofthe mails Bruno Vivien, Marc Jorgensen and herself exchanged with Didier Parigot. It is maintained by Mihaela Sighireanu, Claude Chaudet and the the VASY team. The version of SYNTAX/FNC2 considered is v1.18.





Table of contents


1.
Questions on the distribution and installation of SYNTAX/FNC2
1.1. Where can I find documentation on SYNTAX/FNC2?
1.2. Can I have a sun4 release?
1.3. How to set the environment variables?

2. Questions on fnc2
2.1. How to compile grammar without "null-*" rules?
2.2. How to compile incomplete grammars, the "ntotal" option?
2.3. How to avoid "core dumps" when executing binaries generated with the "ntotal" option?
2.4. How to use imported attributes?
2.5. How to set inherited attributes for the elements of a list phylum?
2.6. May I use local attributes (variables) into a "map" expression?
2.7. Can I use the "+" operator to merge list nodes of the tree?
2.8. Can I use the "op-all" pattern on nodes in an attributed grammar?
2.9. Can I access attributes in user-defined functions?
2.10. May I use "case arity" to compute local attributes?
2.11. How to write tree transformation?

3. Questions on atc
3.1. How to write comments inside an atc rule?
3.2. Can I write recursive user-defined functions for tree construction?
3.3. Does FNC2 collect the memory lost by a tree transformation?
3.4. How to avoid core dump after an error recovering?

4. Questions on asx
4.1. What to do when the message "ERROR 1 : tail (NULL)" apears?
4.2. Can I use the "+" operator on lists?
4.3. When an attribute of type token may receive the value error-token?
4.4. How to print an asx tree?

5. Questions on OLGA
5.1. Can I use functions on strings?
5.2. Can I use "member" operator?
5.3. Can I use overloaded functions?
5.4. Can I use the "INIT" identifier?
5.5. How to use the "message position value" operator?
5.6. Can I use "case ... match"?
5.7. How to trace and debug OLGA descriptions?
5.8. How to declare exported attributes?
5.9. How to avoid evaluation of a grammar when a syntax error is signaled?
5.10. Can I use the constants of type source-index in a OLGA definition module?
5.11. Can I use freely the "+" operation on strings?
5.12. How can I define external types?
5.13. What does this error message mean: OLGA_predef.c:93: undefined reference to `prgentname' ?

6. Questions on evalgen
6.0. NONE?

7. Questions on elim (copy rule elimination)
7.1. What means the error message "This semantic rule is refused."?

8. Questions on coupleur
8.0. TO BE DONE?

9. Question on couplage
9.0. TO BE DONE?

10. Questions on ppat
10.1. Can I use several times PPAT?
10.2. Can I print a token with PPAT?
10.3. Can I print attributes computed in previous grammars with PPAT?
10.4. How to print to stdout?

11. Questions on mkfnc2
11.1. How to declare a `.record' file?

12. Troubleshooting
12.1. Can I use look-ahead functions?
12.2. What is the new form of attribute grammar signaled?
12.3. The listing swaps the number of errors and the number of warning?
12.4. The compilation of C files on iX86 produces some warnings?
12.5. What is the maximal length for the names of files?
12.6. How to use $scx predefined attribute of a transformed tree?
12.7. What to do when the "Grammar not proper" message appears?
12.8. How to find the explanation of the ambiguities of a grammar?

13. Miscelleaneous
13.1. Suggestion on compilation of attribute grammar without null rules?

14. Bugs concerns
14.1. How to report a (possible) bug?
14.2. The list of bugs signaled by the VASY



1. Questions on the distribution and installation of SYNTAX/FNC2


« 1.1. Where can I find documentation on SYNTAX/FNC2?


« 1.2. Can I have a sun4 release?

[Source Mihaela Sighireanu]

Yes, there is a sun4 version of fnc2 availiable. This version is quite new, so there may exist little differences of behaviour with the sun5 version due to the different architectures.


« 1.3. How to set the environment variables?

[Source Mihaela Sighireanu and Bruno Vivien]

If your directories for syntax and fnc2 are resp. /common/Syntax and /common/Fnc2, then the following environment variables shall be set :

setenv sx /common/Syntax
setenv f2 /common/Fnc2
set f2arch = `$f2/doc/sys`
setenv F2PATH .:$f2/lib/$f2arch
set path = ($path $sx/bin/$f2arch $f2/bin/$f2arch $f2/doc)
If you want to compile the C sources generated by fnc2 with the option "-g" use the command :

alias FNC2      "(set path = (/usr/local/gnu/bin $path) ; setenv CFLAGS
g" ; setenv LDFLAGS "-g" ;$f2/doc/FNC2)"


2. Questions on fnc2


« 2.1. How to compile grammar without "null-*" rules?

[Source Bruno Vivien]

ASX elotos-base elotos-base import
OPTION nnull 
end import ;


« 2.2. How to compile incomplete grammars, the "ntotal" option?

[Source Mihaela Sighireanu]

The fnc2 use by default the option "-total" while compiling attribute grammars. This option forces the evaluation of all attributes either if they are not used to compute attributes defined for the root node. When you have this "incomplete" grammars, you obtain the errors at Compilation, for example:

BINARY
cc -o /local_home/users/sighirea/Traian/Code/bin/sun5/traian
Undefined                       first referenced
symbol                             in file
v_141_53_29_26_108_14_12           
/local_home/users/sighirea/Traian/Code/lib/sun5/elotos_int_bind_auto.o
v_141_53_29_26_108_14_13           
/local_home/users/sighirea/Traian/Code/lib/sun5/elotos_int_bind_auto.o
v_29_108_14                        
/local_home/users/sighirea/Traian/Code/lib/sun5/elotos_int_bind_auto.o
ld: fatal: Symbol referencing errors No output written to
/local_home/users/sighirea/Traian/Code/bin/sun5/traian
rm: /local_home/users/sighirea/Traian/Code/bin/sun5/traian: No such file
or directory
gmake: *** [/local_home/users/sighirea/Traian/Code/bin/sun5/traian]
Error 1
In order to avoid such errors you have to add the "OPTION ntotal" line in the traian.mkfnc2 file for the "AG" entries.

Note that the "ntotal" option is not documented in the chapter 18 of the FNC2 manual.


« 2.3. How to avoid "core dumps" when executing binaries generated with the "ntotal" option?

[Source Mihaela Sighireanu]

While using "-ntotal" option, the evaluation of attributes which are not needed by the computation of the "result" attributes is not forced. The compilation with FNC2 does not signal such cases. However, you may obtain an executable which "core dumps" on function `f2___oper_attr`.

To avoid such situations, while working with incomplete grammars (option "ntotal") you have to check if your exported attributes are used in the computation of the resulting attributes (the attributes declared as the result of the attributes grammar in the ag_XXXX.olga file). You can check this by looking to the listing produced by fnc2 for your grammar (tmp/ag_XXXX.olga.l file) at the section RESULTS OF STRONGLY NON-CIRCULAR TEST


« 2.4. How to use imported attributes?

[Source Mihaela Sighireanu (BUG 016 in v1.16)]

An imported attribute ***cannot be used*** as a global attributed in the importing grammar, either it was declared as "global" in the source grammar. This is a known bug of FNC2.

For example, you have the following declarations :

attribute grammar AG1 (ASX1 in ph-axiom ; ASX2 out ph-axiom) : ($correct1 : bool)
is
attribute
	{ exported }
	global $I_A (ph-stmt) : bool;
{ *** your grammar *** }
end grammar
grammar ASX2 is
root is ph-axiom;
	$I_A (ph-stmt) : bool;
end grammar
attribute grammar AG2 (ASX2 in ph-axiom ; ASX3 out ph-axiom) : ($correct2 : bool)
is
attribute
{ *** this grammar uses $I_A [ph-stmt] *** }
end grammar
These declarations are check as correct by fnc2, but the generated binary core dumps on the function `f2___oper_attr`.


« 2.5. How to set inherited attributes for the elements of a list phylum?

[Source Mihaela Sighireanu (BUG 019 in v1.16)]

One of the bugs of the "evalgen" tool concerns the evaluation of attributes while visiting list phylum. This bug appears at the generation of the evaluator for the compound attributes defined on list phylum. For example, the definition given below for the inherited part of the compound attribute $A1 may give strange results due of this bug:

where op-top-level-declarations -> 
ph-top-level-declaration  *
use
	$h.A1 (ph-top-level-declaration) := $h.A1;
end where
To bypass this bug, you have to replace this computation by:

where op-top-level-declarations -> 
ph-top-level-declaration  *
use
	$h.A1 (ph-top-level-declaration) := 
		case position us
			first :	$h.A1;
			other : let t := $s.A1 (ph-top-level-declaration.left) 
				in $h.A1;
		end case;
end where


« 2.6. May I use local attributes (variables) into a "map" expression?

[Source Mihaela Sighireanu (BUG 019 in v1.16)]

Non, the map expressions using local attributes (variables) are not correctly treated by fnc2 (translation to C). For example, the following expression may give strange results at the execution of the generated compiler:

where op-module-expression-list -> 
ph-module-expression  * 
declare
	value
	CORRECT_SIZE : bool := ... ;
use 
	$CORRECT := 
		map left & 
value CORRECT_SIZE
other $CORRECT (ph-module-expression) 
end map; 
end where;
To avoid this bug, please compute the "map" into a local variable, as follows:

where op-module-expression-list -> 
ph-module-expression  * 
declare
	value
	CORRECT_SIZE : bool := ... ;
	CORRECT_MAP : bool :=
		map left & 
value true
other $CORRECT (ph-module-expression) 
end map; 
	
use 
	$CORRECT := CORRECT_SIZE & CORRECT_MAP;
end where;


« 2.7. Can I use the "+" operator to merge list nodes of the tree?

[Source Mihaela Sighireanu]

No, you have to use the op-merge function. For example:

ph-flat-definitions = op-flat-definitions;
op-flat-definitions -> ph-flat-definition *;
map left op-flat-definitions-merge { and not + }
value op-flat-definitions ()
other $s_FLAT_definitions (ph-declarations)
end map


« 2.8. Can I use the "op-all" pattern on nodes in an attributed grammar?

[Source Mihaela Sighireanu]

No, the "op-all" pattern may be use only in atc files. Into an AG you have to use your (recursive) functions and the simple pattern-matching ("case ... is") to obtain the same effect. Example: The destination (exit) abstract grammar is :

ph-flat-behaviour-match-list  = op-flat-behaviour-match-list ;
op-flat-behaviour-match-list -> ph-flat-behaviour-match *;
ph-flat-behaviour-match       = op-flat-behaviour-match ;              
op-flat-behaviour-match      -> ph-flat-pattern
ph-flat-value-expression
ph-flat-behaviour ;
The source grammar contains 'ph-pattern-list' instead of 'ph-flat-pattern' and we want to distribute the 'ph-flat-value-expression ph-flat-behaviour' on each pattern of this list. The following code is not supported:

s_FLAT_behaviour_match_list :=
case $s_FLAT_pattern_list (ph-pattern-list) is
op-flat-pattern-list-all (Pi) :
map tree Pi left op-flat-behaviour-match-list-merge 
value op-flat-behaviour-match-list ()
other case Pi is
op-flat-pattern-list (Pj) :
op-flat-behaviour-match-list (
op-flat-behaviour-match (Pj,
s_FLAT_value_expression (ph-value-expression),
s_FLAT_behaviour (ph-behaviour)));
other :
op-flat-behaviour-match-list ();
end case
end map;
other : { erreur }
op-flat-behaviour-match-list ();
end case;
and you have to write instead:

	$s_FLAT_behaviour_match_list :=
		DISTRIBUTE_P1_Pn_B ($s_FLAT_pattern_list (ph-pattern-list), $s_FLAT_value_expression (ph-value-expression), $s_FLAT_behaviour (ph-behaviour));
where the function DISTRIBUTE_P1_Pn_B is :

function DISTRIBUTE_P1_Pn_B (P1_Pn : ph-flat-pattern-list; VE : ph-flat-value-expression; B : ph-flat-behaviour)
		: ph-flat-behaviour-match-list
is
	case P1_Pn is
	op-flat-pattern-list-pre (P1, tail_P1_Pn) :
		op-flat-behaviour-match-list-pre (
			op-flat-behaviour-match (P1, VE, B),
			DISTRIBUTE_P1_Pn_B (tail_P1_Pn, VE, B));
	other : 
		op-flat-behaviour-match-list ();
	end case
end function;


« 2.9. Can I access attributes in user-defined functions?

[Source Mihaela Sighireanu (BUG 020 in v1.16)]

No, the C code generated actually by fnc2 is incorrect. To avoid this bug write an auxiliary function accessing the attribute; you will obtain only a warning at compilation of the code generated by fnc2. Example:

function CREATE_SEQUENCE_E (E1, E2 : ph-flat-expression) 
ph-flat-expression 
is 
case E1 is 
op-flat-null-expression () : E2; 
other : 
case E2 is 
op-flat-null-expression () : E1; 
other : op-flat-sequential-expression (E1, E2) with $TYPE := $TYPE(E2) { access of the $TYPE attribute } end
with; 
end case; 
end case 
end function; 
should be written

function XXX(E:ph-flat-expression) : TYPE_EXTENDED_ID_LIST is 
TYPE (E) 
end function ; 
function CREATE_SEQUENCE_E (E1, E2 : ph-flat-expression) 
ph-flat-expression 
is 
case E1 is 
op-flat-null-expression () : E2; 
other : 
case E2 is 
op-flat-null-expression () : E1; 
other : op-flat-sequential-expression (E1, E2) with $TYPE := XXX(E2) end
with; 
end case; 
end case 
end function; 


« 2.10. May I use "case arity" to compute local attributes?

[Source Mihaela Sighireanu (BUG 022 in v1.16)]

No, the "case arity" can not be used for attributes declared in the "declare value" section of a rule. Example:

where op-flat-gate-match-list -> ph-flat-gate-match  *
declare value
	DOMAINE : TYPE_DOMAINE :=
		case arity is
			0 :	DOMAINE_VIDE;
			other :	$s.DOMAINE (ph-flat-gate-match.last);
		end case;
	IS_EXHAUSTIVE : bool :=
		if !empty (DOMAINE) then
			message-lotosnt (LOTOSNT_NOT_EXHAUSTIVE_PATTERNS,
					MODE_DEBUG,
					"Gate match list:",
					$scx)
		elsif (EXISTS_GUARD & !EXISTS_ANY) then
			message-lotosnt (LOTOSNT_MAYBE_NOT_EXHAUSTIVE_PATTERNS,
					MODE_DEBUG,
					"Gate match list:",
					$scx)
		else
			true
		end if;
use
	$CORRECT_PH1 := IS_EXHAUSTIVE;
produces an error (signaled by a core dump!!) at the compilation with fnc2. You have to use "case arity" directly to compute the global attribute.

	$CORRECT_PH1 :=
		case arity is
			0 :	message-lotosnt (LOTOSNT_NOT_EXHAUSTIVE_PATTERNS,
					MODE_DEBUG,
					"Gate match list:",
					$scx);
			other :	if !empty ($s.DOMAINE (ph-flat-gate-match.last)) then
				message-lotosnt (LOTOSNT_NOT_EXHAUSTIVE_PATTERNS,
						MODE_DEBUG,
						"Gate match list:",
						$scx)
				elsif (EXISTS_GUARD & !EXISTS_ANY) then
				message-lotosnt (LOTOSNT_MAYBE_NOT_EXHAUSTIVE_PATTERNS,
						MODE_DEBUG,
						"Gate match list:",
						$scx)
				else
					true
				end if; 
		end case;
	


« 2.11. How to write tree transformation?

[Source Mihaela Sighireanu]

attribute grammar AG1 (ASX1 in ph-root1)
($ASX2_ROOT : ph-root2; $CORRECT_AG1 : bool) is
The attribute $ASX2_ROOT should contain the root of the ASX2 tree.

declaration module AG1 is
import grammar ASX1 ;
import grammar ASX2 ;
function AG1 (n1 : ph-root1) : ph-root2
end module ;


3. Questions on atc


« 3.1. How to write comments inside an atc rule?

[Source Bruno Vivien]

If you write comments inside an atc rule as follows :

	_non-terminal_= _other_non_terminals_
{_commented_non_terminal_}  
			_other_non_terminals_
the generated code (by tables_C) considers this comment like a keyword : "{_optional-in-out-record-type_}". You have to avoid comments inside the atc rules.


« 3.2. Can I write recursive user-defined functions for tree construction?

[Source Christophe Discours]

Yes. See FNC2 manual vX.X page ???.


« 3.3. Does FNC2 collect the memory lost by a tree transformation?

[Source Hubert Garavel]

Waiting response.


« 3.4. How to avoid core dump after an error recovering?

[Source Mihaela Sighireanu]

If you use the "null-*" nodes (you don't compile with "-nnull" option), then you should not have such problems. If you use "-nnull" option, atc cannot build correctly the nodes obtained by error recovering. So, you have to test if a syntax error appears in the syntax analysis before the beginning of the semantic analysis. This may be done in your "XXXX_smp.c" file, in the function "XXXXsmp", by testing the variables sxerrmngr.nbmess[1] (nb of errors) and sxerrmngr.nbmess[2] (nb of warnings). For example:

	if ((sxerrmngr.nbmess[1] + sxerrmngr.nbmess[2]) != 0) {
	fprintf (sxstderr, "XXXX:\t Cannot recover from previous syntax errors!\n\tquit\n");


4. Questions on asx


« 4.1. What to do when the message "ERROR 1 : tail (NULL)" apears?

[Source Mihaela Sighireanu]

op-type-array-definition -> 
		   ph-identifier
ph-array-range
ph-identifier
ph-array-range  = op-array-range ;
generate a such message!!


« 4.2. Can I use the "+" operator on lists?

No, because the fnc2 compiler use only "*" operators to compute attributes. If you use "+" operator you can have unexpected "core dump" at the execution of the generated binary.

[99/01/05 - Claude Chaudet] The "+" operator does not produce core dump but acts just like the "*" operator.


« 4.3. When an attribute of type token may receive the value error-token?

[Source Bruno Vivien]

If syntax do a error recovering on a lexical entity, for example %INT, the text is unknown and syntax gives the value error-token to the token.


« 4.4. How to print an asx tree?

[Source Mark Jorgensen]

In the src/XXXX_smp.c file, in the XXXsmp() function, add the line :

	/* Impression de l'arbre (X,Y,Z,T) X: la racine,Y:marge,Z:table pour
la structure des noeud,Z:fichier) */
f2___print_attr_arbre(f2atcvar.atc_lv.abstract_tree_root, 0, f2___atc_table, sortie);
Note that the code of this function is not maintained!!



5. Questions on OLGA


« 5.1. Can I use functions on strings?

[Source Marc Jorgensen]

The following functions on strings defined at page 103 of the manual seems to be not available:

substr omit insert index search verify

You have to use external definitions written in C to define these functions.


« 5.2. Can I use "member" operator?

[Source Marc Jorgensen]

No, the "member" operator described at page 122 of the manual uses type inference (meta-type @T) and, as the file $f2/doc/BUGS says, it is not yet implemented.


« 5.3. Can I use overloaded functions?

[Several sources]

As said in Fnc2/doc/BUGS, overloaded functions are not supported. Description du bug : Quand on a deux fonctions surchargees declarees dans un dec_X.olga

function surchargee (N1 : int; N2 : int) : int;
fonction surchargee (R1 : real; R2 : real) : real;
definies dans le def_X.olga et utilisees dans ag_X.olga, la phase de Construction reussit de typer correctement les fonctions surchargees.

Pour les declarations de dec|def_X.olga FNC-2 genere le code C suivant dans src_fnc2/X_b_df.c

int surchargee (N1 : int, N2 : int) { ... }
real surchargee__real__real (R1 : real, R2 : real) { ... } 
mais dans X_regles.c on retrouve pour l'utilisation de la premiere fonction le nom surchargee__int__int !!! Ce qui provoque des erreurs pendant la phase de Compilation (edition de liens).


« 5.4. Can I use the "INIT" identifier?

[Source Mihaela Sighireanu]

No, because the SYNTAX tool define the "INIT" identifier in the `sxunix.h` file as follows:

#define INIT SXINIT
SXINIT -1


« 5.5. How to use the "message position value" operator?

[Source Mihaela Sighireanu]

The C code generated for this operator is actually incorrect. For example:

message "op-top-level-declarations " + string (CORRECT_PH3)
	position value $scx [ph-top-level-declarations]
severity 2
value CORRECT_PH3;
is translated in:

sxput_error( = arg_1;
%s %s.", sxtab_ptr
err_titles[2],plus___string("op-top-level-declarations "
string___bool(CORRECT_PH3)));
return CORRECT_PH3;
which gives error at C compilation. You have to delete "value" and to write simply "position $scx(foo)".

Moreover, due to this wrong translation, while the "message" operator is used into a expression like "... & message .... &", you have to put the message into a "let", like:

let t : bool := message "PH3 " + string ($CORRECT_PH3
(ph-compilation-unit))
position ph-compilation-unit
severity 1
value $CORRECT_PH3 (ph-compilation-unit)
in
t & ...; { or ... & ... when value is already here }
The same while using the "message" into a "map" operator. Please use the following tick:

function tutu (arg1:bool;sx:source-index;arg2:bool) : bool is
message "ph-top-level-declaration " + string (arg2)
position sx
severity 2
value arg1 & arg2
end function; 
and

CORRECT_PH3 :=
map left tutu
value   true
other   $scx(ph-top-level-declaration), 
				$CORRECT_PH3 (ph-top-level-declaration)
end map;
to write

CORRECT_PH3 :=
map left tutu
value   true
other   $scx(ph-top-level-declaration), 
				message "ph-top-level-declaration " + string (arg2)
position sx
severity 2
value $CORRECT_PH3 (ph-top-level-declaration)
end map; 


« 5.6. Can I use "case ... match"?

[Source Bruno Vivien]

The correct syntax of the "case" expression is "case...is" instead of "case ... match" as suggested by the FNC2 manual (appendix B).


« 5.7. How to trace and debug OLGA descriptions?

[Several sources]

There are no debug tools for OLGA sources. Use C debuggers on the sources generated by fnc2. You can use "message position ... severity ... value ..." construct to write traces.


« 5.8. How to declare exported attributes?

[Several sources]

When a grammar enriches an existent tree, the declaration order of the attributes no modified should be the same in both (input and output) .asx files. This bug is already known.


« 5.9. How to avoid evaluation of a grammar when a syntax error is signaled?

[Source Bruno Vivien]

In order to avoid cumbersome tests on error-token, you can directly test the generation of a error-token after the syntax pass, in the XXXX_smp.c file. For this, test the following variables:

sxerrmngr.nbmess[2]/* nombre de messages d'erreurs */
sxerrmngr.nbmess[1]/* nombre de warnings */
in the XXXX_smp.c file before the call of the attributed grammar.


« 5.10. Can I use the constants of type source-index in a OLGA definition module?

[Source Mihaela Sighireanu]

The constants 'beginning-of-text' and 'end-of-text' of type source-index can be used only into an attributed grammar. To use these constants and other ones in a definition or declaration module you can:

#include "olga_predefinit.h"
struct sxsource_coord beginning_of_text ()
{
return beginning__of__text;
}


« 5.11. Can I use freely the "+" operation on strings?

[Source Mihaela Sighireanu]

The implementation of the "+" operation on strings makes a copy of the first argument and then concatenates (using the C "strcat" function) with the second argument. So, you have to limit its use because the memory may be overfilled.


« 5.12. How can I define external types?

[Source Mihaela Sighireanu]

declaration module XXX is
type TYPE_EXTERNAL ;
end module ;
In this file you can declare other (external or not) types and constants, but only external functions.

#include "olga_predefinit.h"
#include "XXXX_b.h"
/* implementation of external functions declared in dec_XXXX.olga */
The functions declared here can use the external types and the Olga types declared in dec_XXXX.olga.


« 5.13. What does this error message mean: OLGA_predef.c:93: undefined reference to `prgentname' ?

[Source Mihaela Sighireanu and Claude Chaudet]

The problem is caused by the fact that the declaration of variable "prgentname" was removed by you from file main_xxx.c. This problem seems to occur only under Linux.



6. Questions on evalgen


« 6.0. NONE?



7. Questions on elim (copy rule elimination)


« 7.1. What means the error message "This semantic rule is refused."?

[Source Mark Jorgensen]

This message appears when you access directly (without using the "case position" construct) an element of a phylum which is a list.

For example, the following code is WRONG:

where stmt_list -> STMT  + use
	   $h.tool(STMT.first) := "aldebaran" ;
end where ;
and you have to write explicitely:

where stmt_list -> STMT  + use
	   $h.tool(STMT) := case position is
		   first : "aldebaran" ;
		   other : $s.tool(STMT.left);
	   end case;
end where ;
which generate the right computation.



8. Questions on coupleur


« 8.0. TO BE DONE?



9. Question on couplage


« 9.0. TO BE DONE?



10. Questions on ppat


« 10.1. Can I use several times PPAT?

[Source Marc Jorgensen (Fixed in v1.16)]

Yes, the bug described below is fixed in the version >= v1.16.

Je veux utiliser plusieurs fois PPAT. (J'ai besoin d'imprimer l'arbre de deux manieres differentes). Le seul probleme, est que le fichier SVL.c (SVL est le nom de mon langage) est mauvais, car il contient deux fois les definitions de Largeur, Filename, et les include sont aussi fait deux fois, ce qui cause probleme. Du coup, je dois patcher le fichier SVL.c a la main, et m'arranger pour que FNC2 ne le regenere pas.


« 10.2. Can I print a token with PPAT?

[Source Marc Jorgensen (Fixed in v1.16)]

Yes, the bug described below is fixed in the version >= v1.16.

Lorsque j'imprime un token (ici, le token text) avec ppat, celui-ci ne contient pas la bonne donnee. Je contourne le probleme en attachant aux noeuds ou il y a un token text, un attribut contenant le string de text, et j'imprime ce string avec ppat.


« 10.3. Can I print attributes computed in previous grammars with PPAT?

[Source Christophe Discours (BUG 025)] Yes, if the attribute is declared in the input grammar of your ppat. ATTENTION: As long as the calls of attributed grammars and ppat are directly written in XXXX_smp.c, the typechecking is not done. So, if you use a local attribute of a previous grammar, ppat accepts this, but the binary obtained produces a core dump (see BUG 025).


« 10.4. How to print to stdout?

PPAT will print on the stdout if the name of the file given as parameter is empty (i.e. ""). For example:

	ppat___block_debug (R_BLOCK->BLOCK_AXIOM, 80, "");


11. Questions on mkfnc2


« 11.1. How to declare a `.record' file?

[Source Mihaela Sighireanu]

The prefnc2 tool creates a `langage.recor' and you have to modifying it for your application.



12. Troubleshooting


« 12.1. Can I use look-ahead functions?

[Source Marc Jorgensen]

Probleme dans le code engendre par FNC2 : En gros, j'ai des problemes lorsque j'utilise des fonctions "look-ahead" dans ma grammaire attribue. Cette fonction (case B1 is beh_src(SOURCE) ci-dessous) fait que le code produit pour le fichier SVL__check_regles.c va chercher dans la table de symboles : SVL__base_asx_table qui n'existe pas. Seuls SVL__in_asx_table et SVL__out_asx_table sont definis.

ag_SVL-check.olga:
attribute grammar SVL-check (SVL-in, SVL-out) is 
where beh_rv_parallel -> B1 B2 ID_L use
	$network_filename(B1) := case B1 is
beh_src(SOURCE) :
network_filename;
other :
new_exp_file();
end case ;
end where ;


« 12.2. What is the new form of attribute grammar signaled?

[Source Mihaela Sighireanu]

With the version 1.15 of the FNC2, the attribute grammar shall be specified as follows:

attribute grammar _name_
	( _asx_file_ [in|out] _axiom_ { ; _asx_file_ [in|out] _axiom_ } ) 
	: ( _result_attribute_ : _type_ { ; _result_attribute_ : _type_ } ) is
		etc.
end grammar
Note that the new form of attribute grammar is not explicitly signaled when it is not respected.


« 12.3. The listing swaps the number of errors and the number of warning?

[Source Mihaela Sighireanu]

The listing generated with `sxlisting_output` swaps the number of errors and the number of warning. For example 14 warnings are reported but the final message in the ".l" file is: "14 errors and 0 warnings are reported."


« 12.4. The compilation of C files on iX86 produces some warnings?

[Source Mihaela Sighireanu]

On the `warn_12.tar.gz` example.


« 12.5. What is the maximal length for the names of files?

[Source Mihaela Sighireanu]

The tool bnf_read of SYNTAX cut the names of files to 10 characters. So, the name of the language should have maximum 10 characters.


« 12.6. How to use $scx predefined attribute of a transformed tree?

[Source Mihaela Sighireanu]

The $scx predefined attribute cannot be used on the phyla of a transformed tree (the tree not having an atc source). At the initial tree transformation this information is lost. You have to define and to compute your attribute on the transformed tree.. The fnc2 does not signal such (incorrect) uses of $scx and you can have core dump at the execution of the generated binary.


« 12.7. What to do when the "Grammar not proper" message appears?

[Source Mihaela Sighireanu]

You have to search in the listing file tmp/*.bn.l the "error" word. An explanation of the error is given.


« 12.8. How to find the explanation of the ambiguities of a grammar?

[Source Mihaela Sighireanu]

You have to look in the listing file tmp/*.la.l. An explanation for each ambiguity is given.

13. Miscelleaneous


« 13.1. Suggestion on compilation of attribute grammar without null rules?

[Souce Mihaela Sighireanu]

Dans la description de la grammaire il faudra pouvoir specifier si on veut eliminer ou non les regles pour "null-...". Par exemple,

	    attribute grammar nnull X ( ... ) : ... >>
et la generation du fichier XXXX.mkfnc2 doit prendre en compte ces attributs afin de generer automatiquement l'option "nnull" pour cette grammaire (et probablement pour les fichiers qu'elle importe).



14. Bugs concerns


« 14.1. How to report a (possible) bug?

	Number:	_empty_
	Date:	_the_message_date_
	Source:	_your_name_
	Status: _no_for_the_moment_
	Nature:
		_the_bug_description_with_examples_


« 14.2. The list of bugs signaled by the VASY


Copyright (C) INRIA 1998 -- Tous droits réservés -- All Rights Reserved.
Back to the VASY Home Page