|type definitions email@example.com (Justin Hibbits) (2003-05-18)|
|Re: type definitions firstname.lastname@example.org (2003-05-23)|
|Re: type definitions email@example.com (Justin Hibbits) (2003-05-24)|
|Re: type definitions firstname.lastname@example.org (Chris F Clark) (2003-05-29)|
|Date:||23 May 2003 01:37:36 -0400|
|Posted-Date:||23 May 2003 01:37:36 EDT|
Justin Hibbits wrote:
> I'm working on a compiler library, and extensions to yacc to allow
> people to easily write language definitions, and build compilers with
> very little C code in the definition/grammar. But, I'm stuck, and
> can't figure out how to cleanly represent type definitions using a
> yacc-like syntax, so that one only has to write "set_type( TYPE_NAME )"
> in order to set the type, and perform sanity checking (making sure
> types don't conflict, types aren't specified more than allowed, etc).
> ...I want to make my compiler as source-language independant as
"I'm afraid I don't have a solution for you, but I admire the
problem." In this case, I'm reasonably sure a good solution exists,
but the problem may be more complex than you're giving it credit for.
Have you considered the many languages where it is values that have
types rather than variables? In scheme/lisp/most functional languages,
a value of any type may be assigned to any variable. Or languages
like Python, where the variables have type unions (Where each variable
has a set of types and may be assigned only values of those types)?
Or even languages like FORTH-1, where variables don't even exist?
Everything is done with values on the stack and strongly-typed
Return to the
Search the comp.compilers archives again.