Groups | Search | Server Info | Login | Register
Groups > comp.compilers > #197
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!nerds-end |
|---|---|
| From | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
| Newsgroups | comp.compilers |
| Subject | Re: Parsing C#-like generics |
| Date | Tue, 12 Jul 2011 13:25:46 +0100 |
| Organization | Compilers Central |
| Lines | 21 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <11-07-021@comp.compilers> (permalink) |
| References | <11-07-019@comp.compilers> |
| NNTP-Posting-Host | news.iecc.com |
| X-Trace | gal.iecc.com 1310515482 64909 64.57.183.58 (13 Jul 2011 00:04:42 GMT) |
| X-Complaints-To | abuse@iecc.com |
| NNTP-Posting-Date | Wed, 13 Jul 2011 00:04:42 +0000 (UTC) |
| Keywords | parse |
| Posted-Date | 12 Jul 2011 20:04:42 EDT |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | x330-a1.tempe.blueboxinc.net comp.compilers:197 |
Show key headers only | View raw
Harold Aptroot schrieb:
> I'm having some trouble parsing generics when mixed with comparisons. The
> way I try to do it, there is an ambiguity between LessThan and a "list of
> types between angle brackets".
> For example, x<x>(x<x) should be syntactically OK, and it should be parsed
> to a function call x with a type parameter list < x > and a single argument
> which is the expression x<x (ok not really, I threw in semantics here to
> make it clearer, the actual result should just be an AST).
IMO you should better separate declarations from code (statements,
expressions). Then the parser will "know" from that context, that a
declaration can contain <x> type lists, but not x<y expressions.
Above example should parse better as
x<x>{x<x}
where the C style braces around statement blocks allow for better
disambiguation of the < token.
DoDi
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Parsing C#-like generics "Harold Aptroot" <harold.aptroot@gmail.com> - 2011-07-11 20:22 +0200
Re: Parsing C#-like generics Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2011-07-12 13:25 +0100
Re: Parsing C#-like generics BGB <cr88192@hotmail.com> - 2011-07-14 13:13 -0700
Re: Parsing C#-like generics BGB <cr88192@hotmail.com> - 2011-07-12 16:39 -0700
Re: Parsing C#-like generics "Ben L. Titzer" <ben.titzer@gmail.com> - 2011-07-13 10:19 -0700
csiph-web