Re: [Pyparsing] How to distinguish a variable from a integer
Brought to you by:
ptmcg
From: Gustavo N. <me...@gu...> - 2009-05-15 14:37:45
|
Bonjour, Denis ! spir said: > Had a look and find it really interesting (booleano). > Reminds me of a project about customizing computer languages (PL, wiki, > etc), including allowing various natural languages. This should be a kind > of layer (possibly implemented in an editor) between the user and the > standard computer language. The main issue was that key words (not > necessarily reserved words) may well be free words for another user/natural > language. > > E.g. in your example > - Castilian: autor == "David TMX" y álbum.año >= 2008 > - English: author == "David TMX" and album.year >= 2008 > - French: auteur == «David TMX» et album.année >= 2008 > what happens if logical ('and' '==' '>=', probably 'not' 'or'), or maybe > even key ('author' 'album' 'year'), tokens are used with another sense or > context in another user's dialect? Do you need to protect all possible > variants of words having a special meaning in your language? (Even if it > was possible, then user-level choices are impossible). Developers using Booleano should define the variable and function names beforehand; users cannot define variables or functions, just re-use those provided by the application. So, when the developer passes the variables and functions valid in the expressions, Booleano checks that their names aren't reserved words in the grammar (and variable, function and operator names are all case-insensitive). Also, there won't be just one grammar to parse all the expressions. There will be one grammar per localization, so you could only use the French grammar to parse French expressions (not English or Spanish expressions). This way, name collisions are avoided. > > > Buena suerte, y mucho gusto! > > > > ¡Lo mismo digo! ;-) > > > > Thank you! =) > > Bona sort, i molt plaer! (català) OK, now I ran out of ideas 'cause I don't know how to say so in another language ;-) Salut ! -- Gustavo Narea <xri://=Gustavo>. | Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about | |