What is the earliest age at which a person can be cremated after death?
The rules and rituals relating to the Antyēṣṭi (last rites) of a person are contained in what are called the Pitṛmēdha Sūtras and/or Gṛhya Sūtras, the texts that form a part of the ritualistic prescriptions of the Vedas. Such rules are also contained in famous smṛtis like the Manusmṛti, though not in as much depth as the Pitṛmēdha Sūtras.
The Bōdhāyana Pitṛmēdha Sūtras of the Kṛṣṇa Yajurvēda are the one of the most detailed regarding the last rites (note the English translation here has been done by me, it is not quoted from anywhere, but for ease of reading it has been kept under quotes):
अदन्तजातानां निखननं प्रणवेन वा॥३॥ दन्तजातानां व्याहृतिविधानेन वा।
A child whose teeth have not come is to be buried using the Pranava Mantra Om, but for the one whose teeth have come, vyahriti ceremony maybe done. - Praśna 3 Khaṇḍa 6
न प्राक् चौळानां प्रमीतानां दहनं विद्यते॥१०॥ नानुपनीतानां कन्यानां वा पितृमेधः॥११॥
A child who dies before the tonsure-rite (चूड़ाकर्म or मुण्डन) is performed is not burnt..10.. No Pitṛmēdha for a person who’s Upanayanam has not been done or a virgin (unmarried) girl..11.. - Praśna 2 Khaṇḍa 3
The Pāraskara Gṛhyasūtra (belonging to the Śukla Yajurvēda) Adhyāya III, Kaṇḍikā 10, which talks about the ceremony before immersion of bones (उदककर्म)says as under:
अद्विवर्षे प्रेते मातापित्रोराशौचम्॥२॥
When (a child) that has not reached the age of two years dies, his father and mother become impure.
They bury the body without burning it.
नात्रोदककर्म॥७॥ द्विवर्षप्रभृति प्रेतमाश्मशानात्सर्वेऽनुगच्छेयुः॥८॥ यमगाथां गायन्तो यमसूक्तं च जपन्त इत्येके॥९॥
In this case (of the child being younger than two years) no water libations (are performed)..7.. If a child of more than two years dies, all his relations should follow (the corpse) to the cemetery..8.. Singing the Yama song and murmuring the Yama hymn, according to some (teachers)..9..
The prescription of the Manusmṛti is as under:
ऊनद्विवार्षिकं प्रेतं निदध्युर्बान्धवा बहिः।
अलङ्कृत्य शुचौ भूमावस्थिसञ्चयनाद् ऋते॥६७॥
The child that dies while less than two years old, the relations should, after having decked it, place outside, under the ground that is clean and not defiled by heaps of bones. MS 5.67
नास्य कार्योऽग्निसंस्कारो न च कार्यौदकक्रिया।
अरण्ये काष्ठवत् त्यक्त्वा क्षपेयुस्त्र्यहमेव तु॥६८॥
For this child no sanctification by fire shall be performed; nor shall water-offering he made to it; having left it like a log of wood, in the forest, one shall keep aloof for three days. MS 5.68
(Read the comparison of verse 5.67 with the other authors, given right at the end, in the link for the same verse)
However the Manusmṛti also allows an option for performing उदककर्म in the case of children whose teeth have come out or whose naming ceremony has been done:
नात्रिवर्षस्य कर्तव्या बान्धवैरुदकक्रिया।
जातदन्तस्य वा कुर्युर्नाम्नि वाऽपि कृते सति॥६९॥
For the child up to three years of age, the relations shall not make water-offerings; but for one whose teeth had appeared, or whose naming had been done, it may be done optionally. MS 5.69
The view of the Vaikhānasa Smārta Sūtra, Praśna 5 Khaṇḍa 11:
Before teething or before the tonsure-rite there is no fire (but the child must be buried in a pit); until the fifth year for a boy, until the seventh year for a girl there is no fire.
The Garuda Purana also seconds the view of the Pāraskara Gṛhyasūtra and Manusmṛti. Chapter CVI of the Agastya Samhita therein says:
A dead child, who has been dead before completing his second year, should be buried instead of being cremated, and no sort of shraddha or Udaka-kriya (offering of libations of water to a departed spirit) is necessary in that case. The friends or relatives of a child, dead after completing its second year of life, shall carry its corpse to the cremation ground and exhume it in fire by mentally re-citing the Yama Suktam.
To summarise, most of the scriptures are in harmony with each other and the basic rule is that a child whose teeth have not come or whose tonsure samskara has not been performed shall be buried and not cremated. Since these two (teething and tonsure rite) usually happen between 6 to 24 months, the limit of 2 years also holds good.
What is the earliest age at which a person can attend a funeral?
I am not aware of any scriptural prohibition on small children attending funerals. It would be more out of common practice than a prohibition. However the reason for not allowing them could be owing to the following:-
1) Children being very small may be susceptible to possession by unsatisfied souls (Preta or Bhuta).
2) They could become an easy target for Tantric malpractices.
3) Very young children might not be able to understand and come to terms with the level of grief there.
4) Children that small may also get scared seeing everything.