[antlr-interest] Please help with my first project

Philippe Lavoie <philippe.lavoie at cactus.ca> philippe.lavoie at cactus.ca
Thu Jan 23 11:16:54 PST 2003


Hi,

I'm running into several problems and if some kind sould wouldn't mind
helping out, I'd really appreciate it.

I have basically this problem:
  - how to declare context dependant grammar

I want to create a language to be used as an interface to my
mathematical mophology library (i.e. image processing operators). I
think that antlr is up to the challenge but unfortunately it seems I'm
not. I've read a lot of tutorials but it seems it's not enough :(

Here is an example of a program I'd like to parse

// Start
Image image;
Kernel k1;
Kernel k2;

k1 = disk(10);
k2 = matrix(3,3);
k2[0] = "001";
k2[1] = "010";
k2[2] = "100";

image.load("someimage.png");

Image result;
result = (image open k1) close k2;

result.save("result.png");
// End



I can't figure out how to restrict .load and .save to an image that
has been declared nor can I figure out how to differentiate between a
kernel and an image assignment since both k1 or result are viewed as
ID by the lexer.

I could do the above in C++, but I kind of would like to have an
interpreted syntax version like above to speed up my tests.

Thanks for any tips.

Phil


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list