parsing at semantic level due to ambiguities I have a VHDL elaboration engine/simulator. As I understand it, the language syntax allows for ambiguities at syntax level. That is, an assignment

pin_value &lt;= bus(5)


can be interpreted as picking a child of the bus by index. Here the bus is a signal (an object). However, it can also be that paranthis are applied to a type

int_signal &lt;= integer(1.1)


which should be interpreted as type conversion.

I wonder. The elaborator should take the parse tree, instantiate objects and tie them together resolving the names. However, the parser has no idea if the prefix at the parensis is a type or array. So, it treats all parensis as indexed objects.

simple_assignment ::= target &lt;= value_expression { , value_expression } 
value_expression ::= name | literal | function_call | type_conversion 
name ::= simple_name | indexed_name 
indexed_name ::= prefix ( expression { , expression } ) // example: REG_ARRAY(5)    
type_conversion ::= type_mark ( expression )


I do not see how can I distinguish between value_expression and type_conversion at syntactic level. My parser parses both as indexed_name and name resolution, when fails to find array object, falls back into type conversion. I am asking if such case analysis it the only way to handle the problem or more strighnforward approach exists that I am missing?
There is no reason to "distinguish between value_expression and
type_conversion" since, according to the grammar a type_conversion is
a value_expression.

You probably mean to distinguish between indexed_name and
type_conversion ... and possibly also function_call, but you do not
give its syntax, so I am not sure.

I do not know VHDL, but it may be that the syntax you have is the
syntax used to explain the language to users, not the syntax actually
used in the parser. The parser could simply use a grammar that does not distinguish between
indexed_name and type_conversion, and leave the distinction for a
later processing stage, when the lexical entities have been identified
and their "nature" is known: array, type or function name.

Alternatively, and more likely, it is possible that symbol tables are built as the
program is parsed, and when an identifier is found by the lexer
(lexical analyser), the lexer will look in the table and will tell the
parser whether it is a type_mark or a prefix (i.e., array identifier) before
the parentheses. Then the parser can proceed with the proper rule for
type_conversion or indexed_name.