Question: Write a program in C language that will take an input string from the user and use the finite state machine developed in the lecture

Write a program in C language that will take an input string from the user and use the finite state machine developed in the lecture to process the string to determine if all delimiters match correctly or not. The string delimiters are curly braces, parentheses, and square brackets. Only in C language. no CPP. no C++.
There should be 8 separate files/codes
cstack.c
cstack.h
util.c
util.h
fsm.c
fsm.h
main.c
boolean.h
Please help. My codes are n't working and I need an explanation esp for .h files.
Preliminary Analysis for utilities such as is_open(), is_close() and is_brother() for delimiter check FSM
is_open()
Will receive a single character passed to it and return boolean value TRUE or FALSE indicating whether
or not it is an open delimiter.
If character is open parenthesis, open curly brace, or open square bracket
Return boolean value TRUE to indicate character is open delimiter
Otherwise
Return boolean value FALSE to indicate character is not an open delimiter
is_close()
Will receive a single character passed to it and return boolean value TRUE or FALSE indicating whether
or not it is a close delimiter.
If character is close parenthesis, close curly brace, or close square bracket
Return boolean value TRUE to indicate character is close delimiter
Otherwise
Return boolean value FALSE to indicate character is not close delimiter
is_brother()
Will receive a two characters passed to it and return boolean value TRUE or FALSE indicating whether or
not they are matching open/close pair.
Note: First character will be open delimiter and second character will be close delimiter
If open delimiter is left parenthesis and close is right parenthesis OR open delimiter is a left curly brace
and close delimiter is right curly brace OR open delimiter is a left square bracket and close delimiter is
right square bracket
Return boolean value TRUE to indicate they are a matching pair (ie brothers)
Otherwise
Return boolean value FALSE to indicate they are not a matching pair (ie not brothers)Pseudocode for main:
Get a string from user
If string has correctly matched delimiters print "All matched correctly"
Pseudocode for FSM:
Note: This is to be implemented as a subprogram that returns a boolean value of true or false indicating whether or not all
delimiters matched correctly.
State 0(Starting State):
Read next character in input string
If char is open delimiter, next state is 1
If char is close delimiter, next state is 2
If char is end of string, next state is 3
If character is anything else, next state is 4
State 1:
Push open delimiter on stack
Next state is 0
State 2:
If stack is not empty
If the character on top of stack is brother to current character
Next state is 0
Otherwise
Display error message
Return false
Otherwise
Display error message
Return false
Next state is 0
State 3:
If stack is empty
Return true
Otherwise
Display error message
Return false
State 4:
Next state is 0
Note: You are to write and make use of subprograms like is_open, is_close, and is_brother for this program
Write a program in C language that will take an

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!