How to create a Syntax analyzer

Disclaimer: You will need some knowledge of compiler, LR Analyzer, and grammar rules to understand this article.
What is a syntax analyzer and where it is used?
For a crash course, a syntax analyzer is part of the compiler, it is in charge of checking all words and characters in the program and making sure that everything has sense and is in its place. This is done by checking some language rules and making sure it accomplishes every rule that starts.
Where to begin?
You need to know that a syntax analyzer is the second part of the compiler, this means something is before this, and this is called a lexical analyzer, this just makes sure everything in the program is tokenizable and creates a list of tokens for the syntax analyzer to use it.
Also, you will need two other things, a file or two files where the rules of the grammar are written in plain text, one of all the rules, and the other one is an LR table, where its just numbers, 0 meaning null, positive numbers meaning movement, and negative numbers meaning its a rule.
1.- File of LR Rules with their rule number and number of items to pop (Example)
2.- File of LR Table (Example)
Algorithm
First of all, we mentioned we need a list(or QUEUE as referred in the algorithm, because you will always pop the first one) of tokens, we will also need a STACK of integers (or whatever you class using if you wanna return a three, this article DO NOT create a three but its implementable) initialized with a 0 inside, the list of rules file read and in a list of rules, the table file in a bidimensional array.
Now, you can follow this algorithm:
3.- Syntax analyzer algorithm
This way you just will have two kind or returns, if its accepted or an error, and your syntax analyzer will be ready to read all the programs with the LR table grammar you inserted.