gocc icon indicating copy to clipboard operation
gocc copied to clipboard

Making gocc practical for normal sized projects

Open suntong opened this issue 3 years ago • 8 comments

My gocc has been running for over a day now at 100% CPU:

image

First time seeing it, hopefully there is no endless loop caused by my grammar.

suntong avatar Jan 27 '22 05:01 suntong

Ah, it finally stopped:

real    2186m58.446s
user    2412m45.462s
sys     5m40.899s

2187/60/24 = 1.51875 -- It ran for one and half days.

suntong avatar Jan 28 '22 03:01 suntong

3+ days now. image

suntong avatar Feb 04 '22 05:02 suntong

Can you share the grammar? This is really weird.

awalterschulze avatar Feb 04 '22 07:02 awalterschulze

Oh, thanks for the reply. Here it is:

https://github.com/suntong/lang/blob/master/lang/Go/src/parsers/gocc/grm6-sqldef/sqldef.bnf

It's bit long (still unfinished), but still less than 1000 lines.
In prospect,  https://github.com/antlr/grammars-v4/blob/master/sql/tsql/TSqlParser.g4 alone has nearly 4700 lines, I.e.,  nearly 5 times longer, and if plus the Lexer it’ll be 6~7 times long, yet that one I believe compiles in reasonable time. Anything wrong with my syntax/usage? I guess I did put some heavy burden on the lexer side...

BTW, another day has gone by and it is still running.

suntong avatar Feb 04 '22 21:02 suntong

I have to stop it now, as it is taking too much of my memory and I cannot perform my normal daily work now,

image

image

image

It's taking almost half of my 32G memory, and it has been running straight for about eight and half days.

real    12197m20.267s
user    15062m32.699s
sys     32m45.269s

12197/60/24 = 8.47014

I wish I can see when it can finish, but I gave it up now. Somebody try it please to run gocc on https://github.com/suntong/lang/blob/master/lang/Go/src/parsers/gocc/grm6-sqldef/sqldef.bnf.

Thanks

suntong avatar Feb 06 '22 16:02 suntong

This is really weird @goccmack would you like to take a look?

awalterschulze avatar Feb 06 '22 16:02 awalterschulze

@awalterschulze @suntong

It appears that you have created loops in your grammar. I commented out all the productions that were causing unused warnings and now gocc completes:

time gocc sqldef.bnf gocc sqldef.bnf 9.21s user 0.14s system 135% cpu 6.905 total

This is still very long so I suspect that there are problems in in your lexical spec too.

At some stage gocc should catch this type of error but I don't have the time to implement it now.

goccmack avatar Feb 14 '22 13:02 goccmack

Thanks a lot @goccmack, so you commented out only the unused warnings, and now the problem is gone. OK, I'll try to duplicate that at my end, just currently I've lost that building environment that I had before, and am building a brand new machine now. so I'll try to get back to you in a few days... thx again.

suntong avatar Feb 14 '22 20:02 suntong