Hi :>
www.phorum.com has a free forum source code you can download, and www.phpbb.com
if you want to build a forum yourself , you can use database, you can make a table inwhich every record has the data of one post. every record has a replyed-to field that is used to specify if the post is a reply to a previous post, you can save the previous post id in the replyed-to field,
you can use a simple forum model too ,
you can use text files for each subject , every reply will be appended to the text file ,
reply if any questions,
Yours sincerly ,
Amin Rajaee