سؤال

I want to create a small language which allow entering regular expressions. I will be scanning with (f)lex.

Therefore I need the Lex rule for a regular expression. Has anyone done this before?

هل كانت مفيدة؟

المحلول

What is a "lex rule for a regular expression"? That makes no sense. A regular expression (in your language) is nothing that lex will recognize beyond a simple string literal constant. It would be impossible to define a lex rule for it. Any surrounding stuff (markers, etc.) might be tokenizable, such as Perl's s#regex#replace#flags

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top