Something happened to YouCompleteMe, I don't use it anymore. However I remember it as word based. This is the same as the search engine on the bottom of this page: for an input sequence $s_0$ find a list of words that has $s_0$ as prefix. This search can be done quite fast.
Mono Development has a quite complicated complete me engine. It seems both based on syntax, on word search and even on type theory. It is quite fascinating to look at.
Cnn Parser seems quite useful (something similar probably has been used in coding assistants). It is syntax based. So we will have to do word search after token types have been found. I have devised complete_me.py as a showcase. An example run is found in examples/complete_me1.txt. By default the program is started with 10 #include statements to overcome the huge amount of those found in top of every C program. It seems that the program can diverge from one line functions. For example if I write int right after an opening curly brace in a function, it suggests @ident and then on till semicolon and finally closing brace. I think the LSTM (Long Short Term Memory) plays a role here. The predictions are probably based on local context and global.
In all it seems quite dynamic: if you are not satisfied and want to go down another road, just write it and it will try to predict that road. Of course by hacking a table driven parser generator we would have only syntactically correct suggestions. However we would have all of them, then we would have to figure which ones are the most appropriate. With Cnn Parser we have statistical suggestions: the most likely suggestions. Besides that a nn can learn functions. So there should be a good chance that Cnn Parser can become quite correct. On the downside it does not know all next tokens. So if you go down a path of a syntax error, Cnn Parser will probably become quite weird.