Hi Doug: in the WWW directory: /proj/adaptive/www/sources/DemeterJava/examples/j-hp1 we get the behavior below. When we delete the 0 in front of 84, it works. Please can you check. -- Karl PS. This is from a user at HP in Vancouver. -------------------------- Example = ProcId_rd *EOF*. ProcId_rd = ProcId "/" ProcId. ProcId = Integer. Main = . 084/00000070 Parse error at line 1, column 2. Encountered: "84" Was expecting: "/" ... ParseError at Parser.consume_token(Parser.java:87) at Parser._ProcId_rd(Parser.java:252) at Parser._Example(Parser.java:239) at Example.parse(Example.java:13) at Main.main(Main.java:12) From dougo@ccs.neu.edu Sat Mar 8 16:48:10 1997 Received: from vega.neu.edu (vega.ccs.neu.edu [129.10.115.77]) by amber.ccs.neu.edu (8.8.4/8.7.3) with SMTP id QAA17291; Sat, 8 Mar 1997 16:41:52 -0500 (EST) Received: by vega.neu.edu (SMI-8.6/SMI-SVR4) id QAA01895; Sat, 8 Mar 1997 16:41:44 -0500 Date: Sat, 8 Mar 1997 16:41:44 -0500 Message-Id: <199703082141.QAA01895@vega.neu.edu> From: Doug Orleans To: Karl Lieberherr Cc: E-SHIH_CHANE@HP-Vancouver-om10.om.hp.com, kedar@ccs.neu.edu Subject: Re: Demeter/Java questions In-Reply-To: <199703082115.QAA02664@stockberg.ccs.neu.edu> References: <199703082115.QAA02664@stockberg.ccs.neu.edu> X-Face: (4D-osoq?}7M3\EgvbWKo 1. I can't use label "" > --> example: ProcId_rd = ProcId ProcId. > You cannot use any reserved word of the Demeter/Java design language: > to, before, after etc. Eventually I hope to fix this by using JavaCC's "lexical states". But for now, you can't use reserved words as part names. > 3. How do I definite a end of line. such as EOL = "\n". --> don't work > ---> example: message = LIST( String ) EOL. The generated lexical specification currently ignores all whitespace, which includes newlines. Again, eventually I hope to fix this by allowing the user to customize the lexer, but for now you can't do this. > 4. The parse can not handle leading zero if the integer is at > beginning of the line. > You seem to have found a wrinkle. It is being investigated. > > ---> example: > class dictionary => ProcId = Integer. > ProcId_rd = ProcId "/" ProcId. > > data input => 084/00000070 > will have following error message: > parse error at line 1 , column 2. Encountered: > "84" > > Was expecting: > "/" ... > > if change input data to 84/00000070 it work! The lexer reads any integer that starts with "0" as an octal number (just like Java). Since 084 is not a valid octal number, it thinks it is two tokens, 0 and the decimal number 84. For 00000070, however, it reads it as octal 70, which is probably not what you want (decimal 56). Again, this is the fault of the inflexible lexer. > > 5. How can I specify a message is a sequence of string without put `"` > around the string? > You would have to write a little cd expressing the structure of the messages. > If you don't know the structure of the message, this is a situation where > you would like to slightly change the language, as you did. What I suggest is that you write a small program, maybe in sed or awk or perl, that converts your input file (which I'm guessing is in some fixed, pre-specified format) into something that the Demeter lexer can handle, by e.g. putting strings in double quotes, adding syntax to signify the end of line, removing leading zeros, etc. This would probably be easier than converting all your input by hand. --Doug