FAMILIAR-project / familiar-language

FAMILIAR language and API
13 stars 3 forks source link

Compare returns `ARBITRARY`, but the inputs fms are syntactically identical #55

Open ttben opened 5 years ago

ttben commented 5 years ago

I am encountering a case that I can't explain I run the jar FAMILIAR-Standalone-1.0.10-jar-with-dependencies.jar.

I copy/paste the following:

fm1 = FM(NIjTu: EaTL ;  EaTL: [QdnURvNq] [yMEvijwGOU] [qRsQ] [PxY] [EJomhitg] ;)
fm2 = FM(HGcNsZOpvR: [KSp] ;  KSp: [iICXyWfdEr] ;  iICXyWfdEr: (pQKXp|HDN|ElzaF|BHEk|JsKvNZspp)+ ;)
resMerge = merge sunion{fm1 fm2}

Then println resMerge outputs

NIjTu: (HGcNsZOpvR|EaTL)? ;
HGcNsZOpvR: [KSp] ;
EaTL: [QdnURvNq] [yMEvijwGOU] [PxY] [qRsQ] [EJomhitg] ;
KSp: [iICXyWfdEr] ;
iICXyWfdEr: (pQKXp|HDN|ElzaF|BHEk|JsKvNZspp)+ ;
(KSp -> !NIjTu);

Then I create exactly the same FM, thus I wrap its description on one line, and copy paste the following :

clone = FM (NIjTu: (HGcNsZOpvR|EaTL)? ; HGcNsZOpvR: [KSp] ; EaTL: [QdnURvNq] [yMEvijwGOU] [PxY] [qRsQ] [EJomhitg] ; KSp: [iICXyWfdEr] ; iICXyWfdEr: (pQKXp|HDN|ElzaF|BHEk|JsKvNZspp)+ ; (KSp -> !NIjTu);)

Note that I just basically did a 1) create A, 2) show A, 3) parse desc de A

print clone outputs

NIjTu: (HGcNsZOpvR|EaTL)? ;
HGcNsZOpvR: [KSp] ;
EaTL: [QdnURvNq] [yMEvijwGOU] [PxY] [qRsQ] [EJomhitg] ;
KSp: [iICXyWfdEr] ;
iICXyWfdEr: (pQKXp|HDN|ElzaF|BHEk|JsKvNZspp)+ ;
(KSp -> !NIjTu);

So syntaxically the exact same output than print resMerge.

BUT :

fml> compare clone resMerge
res0: (STRING) ARBITRARY
fml> compare resMerge clone
res1: (STRING) ARBITRARY
fml> compare clone clone
res2: (STRING) REFACTORING
fml> compare resMerge resMerge
res3: (STRING) REFACTORING

Why does it return ARBITRARY ? I don't understand.