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

Parser error on 386 arch by int overflows #64

Closed
r3code opened this issue Aug 27, 2019 · 13 comments
Closed

Parser error on 386 arch by int overflows #64

r3code opened this issue Aug 27, 2019 · 13 comments
Labels

Comments

@r3code
Copy link

r3code commented Aug 27, 2019

Windows 7 32-bit
go1.11.2 windows/386
Trying to do:

package main

import (
	"github.com/antonmedv/expr"
)

func main() {
	p, err := expr.Compile("1+2") 
}

Build fails with multiple errors:

Installation failed: # github.com/antonmedv/expr/parser/gen
..\..\..\..\github.com\antonmedv\expr\parser\gen\expr_parser.go:2231: constant 4228579072 overflows int
..\..\..\..\github.com\antonmedv\expr\parser\gen\expr_parser.go:2249: constant 4228579072 overflows int
..\..\..\..\github.com\antonmedv\expr\parser\gen\expr_parser.go:2300: constant 4228579072 overflows int

@antonmedv
Copy link
Member

Looks like Antlr generated code doesn't support 32 bit arch. I think this is Antlr issue.

@r3code
Copy link
Author

r3code commented Aug 27, 2019

@antonmedv I tried to update Go.
Now go version go1.12.9 windows/386 at one PC with Win 7 32bit it fails and at another it works (the same OS version).
How can I help to debug it?

Антон, на одной машине у нас все ОК, на другой такая ошибка. Может как то заставить Antlr перегенерировать код?

@r3code
Copy link
Author

r3code commented Aug 27, 2019

@antonmedv the related issue in Antlr antlr/antlr4#2433

@antonmedv
Copy link
Member

Yes, I think this is only possible to solve it, by solving issue at Antlr. It's really difficult to patch already generated code.

@r3code
Copy link
Author

r3code commented Aug 27, 2019

@antonmedv Strange to see when at one computer it works and at another it fails... looks odd

@antonmedv
Copy link
Member

Yes, but 4228579072 > 2^32 is overflow.

@hoshsadiq
Copy link

This antlr project doesn't seem to be very interested in this issue, I'm thinking, would it make sense to enforce int32 everywhere within this package?

@antonmedv
Copy link
Member

Hmm, why to enforce? I’m thinking about rewriting parser from the scratch actually.

@hoshsadiq
Copy link

I guess my thinking is a bit premature without actually doing any research. I guess I was thinking that since this is an overflow error, it's likely that somewhere in this package int/int64 was used that then is passed into antlr. But once I read your comment I realised that this could equally be happening inside the antlr project.

@antonmedv antonmedv added the bug label Oct 20, 2019
ncarlier added a commit to ncarlier/feedpushr that referenced this issue Jan 3, 2020
Pending resolution of these issues:

- expr-lang/expr#64
- antlr/antlr4#2433
@antonmedv antonmedv changed the title expr/parser/gen "constant overflows int error" during build Parser error on 386 arch by int overflows Jan 21, 2020
@antonmedv
Copy link
Member

Fixed.

I've rewritten the entire parser for this. :)

@r3code
Copy link
Author

r3code commented Feb 26, 2020

@antonmedv Is it here a3582e9 ?

@antonmedv
Copy link
Member

Yes.

@r3code
Copy link
Author

r3code commented Mar 2, 2020

Спасибо!

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

No branches or pull requests

3 participants