Time complexity of parsing algorithms

I want to write a C ++ program to parse an input file of the following form.

input $input1, $in2, $anotherinput, $a, $b, $x; output $out1, $out2, $k; $xyz = $a + $b + $x; $k = $xyz - $in2; ........ ........ ....... $out1 = $k + $b; 

The input file can contain more than 10,000 lines. But most lines will have the form $A = $B + $C What will be the most efficient parsing algorithm to be used in terms of time complexity.

+4
source share
2 answers

Go to the simplest algorithm. I suggest a recursive descent.

+3
source

The question is not entirely clear, but almost any approach I can imagine has a time complexity of O (N), where N is the number of lines in your file. The language you described is very simple.

+3
source

Source: https://habr.com/ru/post/1481584/


All Articles