Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » what is syntactic predicates ?(what is syntactic predicates ?)
what is syntactic predicates ? [message #1732771] Fri, 20 May 2016 07:16 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

Can anybody explain about syntactic predicates ?

What's its need?
Re: what is syntactic predicates ? [message #1732776 is a reply to message #1732771] Fri, 20 May 2016 07:32 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1754
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 20/05/2016 09:16, Sachin Samaram wrote:
> Hi,
>
> Can anybody explain about syntactic predicates ?
>
> What's its need?

There's a section here
https://eclipse.org/Xtext/documentation/301_grammarlanguage.html

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: what is syntactic predicates ? [message #1732777 is a reply to message #1732776] Fri, 20 May 2016 07:54 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Thanks. One more question

I have so many keywords for dbms query like

DbmsKeyWords: ('sql'|'insert'|'into'|'values'|'delete'|'update'|'set'|'select'|'distinct'|'from'|'where'|'exists'|'in'|'is'|'any'|'all'|'some'|'and' |'or'|'left'|'right'|'inner'|'outer'|'join'
|'char'|'datetime'|'float'|'int'|'long'|'create'|'table'|'database'|'drop'|'between'| 'group by'|'having'|'like'| 'escape'|'order'|'asc'|'desc'|'not'|'null'|'avg'|'min'|'max'
|'sum'|'primary'|'foreign'|'key'|'references'|'like'|'escape'|'with'|'engine'|'close'|'column_names'| 'connection'|'close_all_connections'|'declare'|'cursors'|'continue'|'execute'|'cursor'
|'using'|'rpc'|'alias'|'binary'|'catquery'| 'to'|'separator' |'heading'| 'on'|'off'|'column'|'names'|'format'|'occur'|'start'|'unique'|'connected'|'continue_bottom'|'continue_down'|
'continue_top'|'continue_up'|'store'|'file'|'onentry'|'onerror'| 'onexit'|'application' |'autocommit'|'begin'|'browse'|'cancel'|'commit'|'completion'|'run'|'rollback'|'user'|'database'|
'datasource'|'server'|'procedure'|'stored_sub'|'save'|'flush'|'timeout'|'transaction');

Parser compiling fine the above rule but if I use the above rule inside other like

DbmsStmt: 'dbms' (dbmsKeyWords+=DbmsKeyWords)+ & (exp+=Expression); it is not working. Can you please tell me how to achieve it?

Example for DBMS queries:

DBMS WITH CURSOR b1133_in_exec EXECUTE
DBMS CLOSE CURSOR b1133_in_exec

DBMS SQL CREATE TEMP TABLE complaint_errors ( batch_id CHAR (20), \
iss_agency_cd CHAR (3) , \
officer_id CHAR (5) , \
compl_nbr CHAR (11), \
def_name CHAR (50), \
chrg_nbr CHAR (2) , \
field_name CHAR (36), \
error_message CHAR (50), \
reject_ind CHAR (1), \
message_id CHAR (10)) \
WITH NO LOG


DBMS DECLARE get_dummy CURSOR FOR \
SELECT parm_val_int dummy_per\
FROM parameters WHERE parm_nbr = 29
DBMS WITH CURSOR get_dummy EXECUTE
DBMS CLOSE CURSOR get_dummy

b1133_db_table_name = "INTERNAL_EVENT"
DBMS DECLARE get_event CURSOR FOR \
SELECT event_cd b1133_event_cd\
FROM internal_event \
WHERE process_id = "BPS1133" \
AND internal_event_id = 4
DBMS WITH CURSOR get_event EXECUTE
DBMS CLOSE CURSOR get_event

The keywords like DBMS, WITH, CURSOR etc should be displayed keyword color.
Re: what is syntactic predicates ? [message #1732778 is a reply to message #1732777] Fri, 20 May 2016 07:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
is this a question on syntax coloring or about parse errors.

please give a complete minimal grammar and example that reproduces your problem


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: what is syntactic predicates ? [message #1732782 is a reply to message #1732778] Fri, 20 May 2016 08:15 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
I don't know what term should I use. But my simple question is I have a dbms query as for example:

DBMS SQL CREATE TEMP TABLE complaint_errors ( batch_id CHAR (20), \
iss_agency_cd CHAR (3) , \
officer_id CHAR (5) , \
compl_nbr CHAR (11), \
def_name CHAR (50), \
chrg_nbr CHAR (2) , \
field_name CHAR (36), \
error_message CHAR (50), \
reject_ind CHAR (1), \
message_id CHAR (10)) \
WITH NO LOG

Here in the above grammar I want show DBMS, SQL, CREATE, TEMP, TABLE, CHAR, WITH, NO, LOG as keywords.

I tried as shown in above comment and also used terminal rule. No luck.

Please find the attached grammar file for dbms.

[Updated on: Fri, 20 May 2016 01:14]

Report message to a moderator

Re: what is syntactic predicates ? [message #1732788 is a reply to message #1732782] Fri, 20 May 2016 08:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
well that is not what i call a minimal grammar.

then your grammar does not built at all due ambiguity. i assume you have enabled backtracking.
and ignoreCase as well.

then the DbmsStmt rule is nowhere called.
thus you cannot expect it wo work

i assue it goes into Statements alternatives.

but as said: in this grammar there is way too much stuff to tackle down the problem.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: what is syntactic predicates ? [message #1732791 is a reply to message #1732788] Fri, 20 May 2016 08:40 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Yes you are right I enabled ignoreCase. So what should I do in this case? Sugeestions?
Re: what is syntactic predicates ? [message #1732792 is a reply to message #1732791] Fri, 20 May 2016 08:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
id stongly recommend to create a new play project with a minimal grammar reproducing the problem

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: what is syntactic predicates ? [message #1732821 is a reply to message #1732792] Fri, 20 May 2016 13:04 Go to previous message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Those all grammar is required. But is there any fix i can make?
Re: what is syntactic predicates ? [message #1732822 is a reply to message #1732821] Fri, 20 May 2016 13:01 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
Hi,

i do not have the time and mood to fix your complete grammar.
it has too many problems to takle down at once.
thus the only thing i can do i to offer your help on a stripped down example.
this example would help you to understand your problem better.
and you should not introduce new stuff into a grammar that is already "exploding".

=> solve your problems step by step.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:@Check Validator with 2 or more parameters
Next Topic:Xtext dbms grammar
Goto Forum:
  


Current Time: Wed Nov 13 09:33:59 GMT 2019

Powered by FUDForum. Page generated in 0.02403 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top