Vladimir Propp tried to work out a sort of grammar of Russian folk tales - I don't know his sample but believe it was quite small, and there are all sorts of questions about his methodology. I'm quite sceptical about what he comes up with, but nevertheless find such ideas fascinating.
Here are two synopses of Propp's morphology from various web sources. (I have fuller information on this, Aarne-Thompson, and related ideas, for example Jungian Archetype theory, available on request) -
Vladimir Jakovlevic Propp (1895-1970)
Morphology of the Folktale (1928)
sought-for person (and her father)
l. One of the members of a family absents himself from home.
2. An interdiction (ban) is addressed to the hero.
3. The interdiction is violated. (The villain usually enters the story here.)
4. The villain makes an attempt at reconnaissance.
5. The villain receives information about his victim. (The villain gets an answer.)
6. The villain attempts to deceive his victim by using persuasion, magic, or deception.
7. The victim submits to deception and thereby unwittingly helps his enemy. (Hero sleeps.)
Villainy / Lack (Plot set in motion):
8. The villain causes harm or injury to a member of a family.
8a. One member of a family either lacks something or desires to have something.
9. Misfortune or lack is made known: the hero is approached with a request or command; he is allowed to go or he is dispatched.
10. The seeker (hero) agrees to or decides upon counteractions.
11. The hero leaves home.
12. The hero is tested, interrogated, attacked, etc. which prepares the way for his receiving either a magical agent or helper.
(The donor usually enters the story here.)
13. The hero reacts to the actions of the future donor.
14. The hero acquires the use of a magical agent.
15. The hero is transferred, delivered, or led to the whereabouts of an object of search.
Path A: Struggle and Victory over Villain; End of Lack and Return:
16. The hero and villain join in direct combat.
17. The hero is branded.
18. The villain is defeated.
19. The initial misfortune or lack is liquidated.
20. The hero returns.
21. The hero is pursued.
22. The hero is rescued from pursuit.
Path B: Unrecognised Arrival, Task, Recognition, Punishment, Wedding:
23. The hero, unrecognised, arrived home or in another country.
24. A false hero presents unfounded claims.
25. A difficult task is proposed to the hero.
(Trial by drink, fire, riddle, test of strength.)
26. The task is resolved or accomplished.
27. The hero is recognised, often by a mark or an object.
28. The false hero or villain is exposed and / or punished.
29. The hero is given a new appearance.
30. The villain is punished.
31. The hero is married and ascends the throne.
The hero or victim/ seeker,
(reacts to the donor, weds the princess)
(struggles against the hero)
(prepares the hero or gives the hero some magical object)
The (magical) helper
(helps the hero in the quest)
(person the hero marries, often sought for during the narrative)
(character who makes the lack known and sends the hero off)
The false hero/ anti-hero/ usurper
(takes credit for the hero's actions/ tries to marry the princess)
(These characters are not exclusive - for instance, the false hero can also be the villain in disguise; the dispatcher can also be the donor.)
1. A member of a family leaves home/ the hero/ victim is introduced
2. A prohibition/ rule is imposed on the hero (e.g. don't do x because...)
3. The hero breaks the rule
4. The villain tries to find out information about the hero/ victim
5. The villain learns something about the hero/ victim
6. The villain tries to deceive the hero/ victim in order to get possession of him / his belongings
7. The hero is deceived/ the victim is deceived into helping the villain
8. The villain harms a member of the family/ steals a desired object, which must be retrieved
A member of the hero/ victim's family lacks or desires something.
Either of these becomes "The Lack", the satisfaction of which is the focus of the narrative.
9. The lack/ misfortune is made known; the hero is given a request or command and is sent/ goes on a mission / quest to satisfy the situation
10. The hero/ seeker plans action against the villain
11. The hero leaves home
12. The hero is tested/ interrogated and as a result prepares to receive either a magical agent or a helper
13. The hero responds to the test/ actions of the future donor
14. The hero gets/ uses the magical object/ helper
15. The hero is transferred to the general location where "the lack" can be resolved
16. The hero and villain in direct combat
17. The hero is branded
18. The villain is defeated
19. "The lack" is set right: the object of the quest is obtained by the hero (often the tale ends here, but can continue.)
20. The hero sets out for home
21. The hero is pursued
22. The hero is rescued from pursuit (sometimes the tale ends here)
23. The hero arrives home or elsewhere and is not recognised
24. A false hero arrives making false claims
25. A difficult task is set for the hero
26. The hero resolves the task
27. The hero is recognised
28. The false hero/ villain is exposed
29. The hero is transformed
30. The villain is punished
31. The hero marries and is crowned
The functions are not prescriptive, rather they are a template from which narratives choose elements. According to Propp, a tale may skip functions but it cannot shuffle their unvarying order. Some narratives subvert the functions (although the functions need to be identifiable in order to be subverted.)
More detail in my archives.