C, a reference manual (4th ed.)
C, a reference manual (4th ed.)
Core Java
A narrative history and description of MOSIS software
Journal of Systems and Software
An efficient context-free parsing algorithm
Communications of the ACM
A language processor and a sample language.
A language processor and a sample language.
Hi-index | 0.00 |
A type system serves to guarantee that programs mix data of distinct types only as allowed by programmer declared rules. For example, a function declaration corresponds to one of these rules, providing a way to mix data of distinct types, possibly producing data of another type as a result. A type system also discovers the type of each (sub)expression throughout a program. This paper introduces a type system where types are parts of speech, and all relations among types are represented by a grammar, a grammar whose rules are written in terms of the types. In order to resolve types, i.e., discover which type each (sub)expression is, the type grammar may be used to parse a given program, as a second pass. A brief, Polish postfix programming language rich in types is presented, called the type grammar, as well as a way to translate down from a more natural syntax. We show how to extend the type grammar with new rules based on program declarations. By parsing with this postfix type grammar, unrestricted overloading (more powerful than Java's) and unrestricted programmer-defined coercions (in some ways more powerful than multiple inheritance) may be implemented and understood in a straightforward manner. To realize these, a powerful parser like Earley's efficient context-free parser, or others, which tolerate ambiguity efficiently, are required. We conclude by showing how a pair of coercions, in a cycle, proves useful.