|
|
Re: replace references [message #736926 is a reply to message #736911] |
Fri, 14 October 2011 13:24 |
samir Messages: 27 Registered: September 2011 |
Junior Member |
|
|
if this was my grammar
Prog : ('Types{'(td += TypeDich';')*'}')?
('Declarations{'(d += Dich';')*'}')? 'Main{'(main = Term)'}';
Dich : name = ID '=' term = Term;
Nrif : nome = [Dich];
Term : Var | Abs | App | Uq | Tapp| Nrif| 'let'var = variable '=' t1 =Term 'in' t2 = Term;
Var : name = variable;
Abs : '\\('param = variable ':' type = T').'body = Term;
App : '('t1 = Term ')' t2= Term;
Uq : '/\\'var = tvar'.'term = Term;
Tapp: => '('term = Term')'type = T;
T : p=tvar ('->'c+=T)* | '('p1=T')' ('->'c1+=T )*|'forall' var=tvar t=T|Trif;
TypeDich : name = ID '=' type = T;
Trif : nome = [TypeDich];
terminal variable : ('a'..'z')+;
terminal tvar : ('A'..'Z')+;
e ho un programma come questo
Types{
Bool = A->B->A;
Id = A->A;
}
Declarations{
True = \(t:B).\(f:B->B).t;
False = \(t:B).\(f:B).f;
Not = ((\(b:B).b) True) False;
Adf = let x = True in Not;
}
Main{
(True)False
}
I want to do is to replace all references to the place of the term reported. before calling the interpreter
For example, in the main I want to replace instead of True WITH \(t:B).\(f:B->B).t.
I'm asking is how can I make?
[Updated on: Fri, 14 October 2011 13:37] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03393 seconds