Ideal top tube length for BMX
This is the tool you're looking for:

https://www.ebicycles.com/bicycle-tools/frame-sizer/bmx-bike

It's not a linear calculation, but it would be fair to say that a rough estimate is: start with a 22.5" top tube for a 6' adult male, and add/subtract half an inch of top tube for every inch of height.