This project is read-only.

Case-insensitive parser

Jan 27, 2012 at 8:30 PM
Edited Jan 27, 2012 at 8:31 PM


I've been writing an meta# parser for the SQL like language. Is it even possible to define a grammar for such case-insensitive  language? Any ideas on how to accept a sequence that matches some input (of character), without regard to case?



Jan 30, 2012 at 5:08 PM


I would love to hear more about what you are working on but basically you can define a rule that accepts upper or lower case letters for identifiers, for example:

Identifier = CaseInsensitiveLetter (CaseInsensitiveLetter | Number)+;

CaseInsensitiveLetter = 'A'..'Z' | 'a'..'z';

Jan 30, 2012 at 7:23 PM


Thanks for the quick reply, but what i really want is to define а keyword that accept "insert" or "INSERT" or any other permutation of case.

Jan 31, 2012 at 2:48 AM

Off the top of my head I think you would have to do something like this:

A = 'a' | 'A';
B = 'b' | 'B';
C = 'c' | 'C';
Z = 'z' | 'Z';

Insert = [I N S E R T];

Jan 31, 2012 at 7:20 AM


Thank you. I'll check it.