Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamllex, FEATURE WISH #3195

Closed
vicuna opened this issue Sep 30, 2004 · 1 comment
Closed

ocamllex, FEATURE WISH #3195

vicuna opened this issue Sep 30, 2004 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Sep 30, 2004

Original bug ID: 3195
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

Full_Name: Per Larsson
Version: 3.08
OS: linux
Submission from: 1-1-8-41a.ens.sth.bostream.se (82.182.158.5)

The inclusion of the character set difference operator (#) was a nice extension
to ocamllex syntax. Now there remains to handle character set union!
For an illustration of the problem, consider the following example:

let lower = ['\097'-'\122' '\181' '\223'-'\246' '\248'-'\255']
let upper = ['\065'-'\090' '\192'-'\214' '\216'-'\222']
let graph = ['\033'-'\126' '\160'-'\255']
let alpha = lower | upper
...

Now you can't define a character set

let punct = graph # alnum INVALID!!

The reason is that the character set property is defined syntactically and
therefore excludeds 'alpha'. There seems to be at least two easy solutions to
the problem:

(1) Let (a | b) be a character set if a and b is

(2) Extend the [...] [^ ...] contexts to include items which are themselves
(names of) character sets, i.e. you should be allowed to write character sets in
the style:

let alpha = [lower upper]
let print = [^ cntrl]
let alnum = [alpha '\048'-'\057']

(IMHO, this second extension seems to be very natural and could be considered
even if the # operator hadn't accentuated the need. This is also the solution in
"ALEX" a lexer generator for haskell.)

Best regards
Per Larsson

@mshinwell
Copy link
Contributor

I'm afraid the WISH has not been granted (sixteen years later)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants