OneCompiler

solve

153

build a haskell program that solves references in a text
your program will receive an input file representing a text.
This text will contain elements of type section, figure and table.
Also, it will contain references (ref) to the elements in the text. Your program must keep the text as is, but must replace the functions.
A function starts with the character '' which will be followed by a function name: section, figure, table or ref. These functions will have arguments, each argument will be between braces. The functions section,
figure and table have two arguments, a first string representing the title of the section and a string representing an identifier. The ref function has only one argument, a string string representing an identifier.
Your program should first locate these functions and number the sections, figures and tables in the order in which they are encountered from the beginning of the text. Each function is numbered independently. The first figure encountered will be numbered 1, the first table encountered will be numbered number 1 and the first section encountered will have the number 1. When a section is encountered, the
counters for figures and tables must be reset to 1.
Finally, you must replace each function with text