References doesn't work in my grammar [message #1791258] |
Tue, 26 June 2018 22:58  |
Eclipse User |
|
|
|
I'm new to XText, and I'm doing a project for the university, so I have this grammar that tries to look like function definitions of the programming language Racket:
Program:
func+=Function+
;
Function:
'(' def=Definition ')'
;
Definition:
'define' funcName=FunctionName body=(SimpleBody | Body)
;
FunctionName:
(ComplexFuncName | SimpleName)
;
ComplexFuncName:
'(' name=ID (parameters+=SimpleName)+ ')'
;
SimpleName:
name=ID
;
SimpleBody:
eval=Exp
;
Body:
'(' eval=Eval ')'
;
Eval:
op=Operator (arg+=(Exp | Body))+
;
Operator:
OperadorAritmetico
;
OperadorAritmetico:
name=('+' | '-' | '*' | '/')
;
Exp:
AtomVal | AtomInt
;
AtomVal:
ref=[SimpleName]
;
AtomInt:
val=INT
;
When I run the eclise runtime application, I create a file with the next code:
(define a 10)
(define (f1 x) (+ a x))
When I reference the name of "SimpleName" it works with the definition of "a", but when I try to reference the parameter "x", that is also a "SimpleName" it doesn't work, why is that happening? help please.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04667 seconds