[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem in Centaur



In article <1998Mar5.034113.17875@sophia.inria.fr>, ibrahim@fit.qut.edu.au (Rosziati Ibrahim) writes:
|>  Hi
|>  I'm a beginner in learning centaur tool. So bear with me.
|>  I'm following the tutorial exercise for creating Exp language.
|>  If I want to expand the type of the language to type real, string 
|>  and character, what sort of digits/characters that I should change in the 
|>  Exp.tokens file?
|>  ie for integer [0-9][0-9]*[0-9][0-9]*
|>     for char [a-zA-Z]   - perhaps(?)
|>     for string [a-zA-Z][a-zA-Z_0-9]* -perhaps(?)
|>     for real  [0.0-9.9] - ??????

It depends of the CONCRETE syntax that you want for your reals, strings and characters,
 it  could be : 

\\"[^\\"\\n]*\\"   for strings  between ":     "This is a String"
'[^'\\n]'	   for a char between ':        'a'
[0-9][0-9]*        for integer, this allows prefixing any integer by on or more 0: 03 or 123
[0-9]*\\.[0-9]*    for real :              3.14159 or .2343435345 

NB: in the .tokens file some characters must be prefixed be the escape character \ 
for lex (for example . "),
 and you must  write two such escape characters because of a sed filter applied to the 
.tokens file  to generate the lex source.

--Laurence Rideau - I.N.R.I.A. Sophia-Antipolis - France

http://www.inria.fr/croap/personnel/Laurence.Rideau/me.html
email:Laurence.Rideau@inria.fr