Using Hampi to generate constraints od the type >

21 views
Skip to first unread message

Bikash Chandra

unread,
Sep 13, 2011, 4:51:26 AM9/13/11
to hampi-devel
Hi,

I am trying to generate some string lexicographically greater than or
equal to a given string. Let the given string be "C" for the moment.
The hampi code that I have written is

var v : 10;

cfg Digit := ['0'-'9'];
cfg Letter := ['a'-'z'] | ['A'-'Z'];
cfg Ascii := Letter | Digit | " " | "'";
reg Asciistar := star(Ascii);
reg Greater:= concat("C", Asciistar,"");

assert v in Greater;

Running hampi on this file throws an exception:

java.lang.NullPointerException
at
hampi.parser.HConstraintPreparer.prepareRegForVar(HConstraintPreparer.java:
171)
at
hampi.parser.HConstraintPreparer.prepareRegexp(HConstraintPreparer.java:
204)
at
hampi.parser.HConstraintPreparer.prepareRegexp(HConstraintPreparer.java:
188)
at
hampi.parser.HConstraintPreparer.prepareRegForVar(HConstraintPreparer.java:
172)
at
hampi.parser.HConstraintPreparer.prepareRegexp(HConstraintPreparer.java:
204)
at
hampi.parser.HConstraintPreparer.prepareRegexps(HConstraintPreparer.java:
214)
at
hampi.parser.HConstraintPreparer.prepareRegexp(HConstraintPreparer.java:
196)
at
hampi.parser.HConstraintPreparer.prepareRegForVar(HConstraintPreparer.java:
172)
at
hampi.parser.HConstraintPreparer.prepareIn(HConstraintPreparer.java:
144)
at hampi.parser.HConstraintPreparer.prepare(HConstraintPreparer.java:
47)
at hampi.parser.HConstraintPreparer.prepare(HConstraintPreparer.java:
34)
at hampi.Hampi.run(Hampi.java:294)
at hampi.Hampi.run(Hampi.java:270)
at hampi.Hampi.main(Hampi.java:249)


Could you please tell me what is wrong with my hampi code. I am using
the hampi code uploaded on May28,2010 which is the latest version on
svn.

Devdatta Akhawe

unread,
Sep 13, 2011, 8:01:46 AM9/13/11
to hampi...@googlegroups.com
try

> var v : 10;
>
> cfg Digit := ['0'-'9'];
> cfg Letter := ['a'-'z'] | ['A'-'Z'];
> cfg Ascii := Letter | Digit | " " | "'";

> cfg Asciistar := Ascii Asciistar | ;
> cfg Greater:= "C" Asciistart;
>
> assert v in Greater;


On 13 September 2011 01:51, Bikash Chandra

Bikash Chandra

unread,
Sep 13, 2011, 11:18:18 AM9/13/11
to hampi...@googlegroups.com
Thanks.
The length of v is constant which is equal to 10. If I want to let the range of v vary from 2 to 10. I should define
var v: 2..10

But this gives a parse error

ERROR Parse errors
line 1:1 no viable alternative at input 'var'
--
Bikash Chandra.

Adam Kiezun

unread,
Sep 13, 2011, 11:21:53 AM9/13/11
to hampi...@googlegroups.com
Bikash,
are you using the latest from SVN?

also, there's a quirk/bug in the parser, try playing with spaces, eg "2 .. 10" etc
./adam


Bikash Chandra

unread,
Sep 13, 2011, 11:34:13 AM9/13/11
to hampi...@googlegroups.com
Thanks Adam for the clarification.
BTW I just figured out that using Kaluza would be a better option for the type of problems I am interested to solve. Should i direct my queries regarding Kaluza directly to you or there is some group for that

Prateek Saxena

unread,
Sep 13, 2011, 1:42:33 PM9/13/11
to hampi...@googlegroups.com

Hi Bikash,

Please direct your queries to me (Prateek) @ prat...@cs.berkeley.edu directly if you are interested in using Kaluza (http://webblaze.cs.berkeley.edu/2010/kaluza/)

Cheers,

Prateek.

Reply all
Reply to author
Forward
0 new messages