『杭電1149』Structural Equivalence

Problem Description

In programming language design circles, there has been much debate about the merits of "structural equivalence" vs. "name equivalence" for type matching. Pascal purports to have "name equivalence", but it doesn't; C purports to have structural equivalence, but it doesn't. Algol 68, the Latin of programming languages, has pure structural equivalence.

A simplified syntax for an Algol 68 type definition is as follows:

 

type_def -> type T = type_expr

type_expr -> T | int | real | char | struct ( field_defs )

field_defs -> T | field_defs T

 

In this syntax, T is a programmer-defined type name (in this problem, for simplicity, a single upper case letter). Plain text symbols appear literally in the input, and zero or more spaces may appear where there are spaces in the syntax.

 

Algol 68 type equivalence say that two types are equi

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章