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

cmd/compile: lexer should provide binary ops and precedences #13244

Closed
griesemer opened this issue Nov 14, 2015 · 2 comments
Closed

cmd/compile: lexer should provide binary ops and precedences #13244

griesemer opened this issue Nov 14, 2015 · 2 comments
Milestone

Comments

@griesemer
Copy link
Contributor

Tracking issue.

The lexer already knows the operators and could directly determine the corresponding (Node) Op and operator precedence. This would eliminate a map lookup when parsing binary expressions, which is an extremely frequent operation.

Target 1.7 Early.

@griesemer griesemer self-assigned this Nov 14, 2015
@griesemer griesemer added this to the Unplanned milestone Nov 14, 2015
@griesemer
Copy link
Contributor Author

Also: At the same time the lexer could translate '~' to '^' so we don't have to deal with it later.

@griesemer griesemer modified the milestones: Go1.7, Unplanned Nov 17, 2015
@gopherbot
Copy link

CL https://golang.org/cl/19928 mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue Mar 16, 2016
The parser code was not reachable ever since some of the lexer cleanups.
We could recognize '~' in the lexer, complain, and return a '^' instead,
but it's been a few years since Go was new and this may have been a use-
ful error. The lexer complains with "illegal character U+007E '~'" which
is good enough.

For golang#13244.

Change-Id: Ie3283738486eb6f8462d594f2728ac98333c0520
Reviewed-on: https://go-review.googlesource.com/20768
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants