MATLAB: Do I receive a ‘stack parser overflow, program too complex’ error when having a large Truth Table in Stateflow 7.9 (R2012a)

stateflow

My model contains a Stateflow chart with a Truth Table that has 100 condition lines. When trying to simulate the model I receive the following error:
[...]
### Compiling "c14_reducedmodel_error.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /I "C:\Program Files\MATLAB\R2012a\extern\include" /I "C:\Program Files\MATLAB\R2012a\simulink\include" /I "C:\Program Files\MATLAB\R2012a\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2012a\stateflow\c\debugger\include" "c14_reducedmodel_error.c"
c14_reducedmodel_error.c
c14_reducedmodel_error.c(91150) : fatal error C1026: parser stack overflow, program too complex
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe"' : return code '0x2'
Stop.
When I reduce the number of condition lines to 88, it runs without issues.
I am using Microsoft Visual C++ 2008 SP1 (Microsoft Visual Studio 9.0).

Best Answer

This is a known compiler limitation which we occasionally hit when having really large charts or Truth Tables in Simulink models.
To work around this issue you need to replace your large Truth Table with multiple smaller Truth Tables. Generally it is not advisable for a model to have such a large Truth Table as it makes the model hard to read and understand. It is best to break it up into multiple Truth Tables that help both the readability as well as the scalability of the downstream tools.