[Paper Review] AN EXPERIMENT WITH A USER MANUAL BASED ON A DENOTATIONAL SEMANTICS (working version)
This paper presents a user manual for the programming language Lingua, formally defined using denotational semantics based on many-sorted algebras and three-valued logic. It integrates abstract syntax, type systems, and error handling into a mathematically rigorous yet accessible framework for professional programmers, demonstrating how formal semantics can guide practical language documentation.
Denotational models should provide an opportunity for the revision of current practices seen in the manuals of programming languages. New styles should on one hand base on denotational models but on the other - do not assume that today readers are acquainted in this field. A manual should, therefore, provide some basic knowledge and notation needed to understand the definition of a programming language written in a new style. At the same time - I strongly believe that - it should be written for professional programmers rather than for amateurs. The role of a manual is not to teach the skills of programming. Such textbooks are, of course, necessary, but they should tell the readers what the programming is about rather than the technicalities of a concrete language. The paper contains an example of a manual for a virtual programming language Lingua developed in our project.
Motivation & Objective
- To develop a user manual for a programming language that is formally grounded in denotational semantics rather than informal or ad hoc descriptions.
- To make formal language definitions accessible to professional programmers without requiring prior expertise in formal methods.
- To integrate type systems, error handling, and evaluation semantics into a unified mathematical framework using many-sorted algebras.
- To demonstrate that denotational semantics can serve as a practical foundation for language documentation, not just theoretical specification.
- To provide a reusable model for designing future programming languages with formally specified, machine-checkable semantics.
Proposed method
- Defining the language Lingua using a denotational model based on many-sorted algebras, where each syntactic construct maps to a mathematical denotation.
- Employing a three-valued propositional calculus to model abstract errors, distinguishing between valid results, errors, and undefined states.
- Introducing 'abstract errors' as a formal mechanism to represent runtime failures within the semantic model, ensuring type safety and error transparency.
- Using equational grammars to define the syntax of expressions, types, and instructions, with clear separation between concrete and abstract syntax.
- Defining semantic clauses through recursive mappings: e.g., the evaluation of a procedure call is modeled as a state transition involving data, transfer, and type denotations.
- Integrating imperative and applicative layers via a structured semantic framework where values, types, and operations are formally related through algebraic constructs.
Experimental results
Research questions
- RQ1Can a user manual for a programming language be effectively built on a denotational semantics without assuming prior knowledge of formal methods?
- RQ2How can abstract errors be formally modeled within a denotational framework to support precise error reporting and type safety?
- RQ3To what extent can a many-sorted algebraic approach unify the specification of syntax, types, and evaluation in a programming language?
- RQ4Can a formal semantic model be made accessible and usable by professional programmers without requiring deep mathematical training?
- RQ5How can the interplay between data, transfer, and type expressions be formally captured to ensure consistency and coherence in program execution?
Key findings
- The paper successfully demonstrates that a user manual can be constructed using denotational semantics as a foundation, even for non-expert readers, by integrating foundational concepts like many-sorted algebras and three-valued logic.
- Abstract errors are formally modeled as a distinct semantic domain, enabling precise error detection and reporting through transparent error propagation in the evaluation process.
- The semantic model ensures type coherence by validating that transfer expressions map correctly to composite types, rejecting invalid or inconsistent operations.
- The evaluation of procedure calls is formally defined through state transitions involving data, transfer, and type denotations, with explicit checks for coherence and type correctness.
- The framework supports both eager and lazy evaluation strategies through distinct semantic clauses, allowing for formal reasoning about program behavior.
- The integration of preamble, program structure, and procedure declarations into a single formal model enables consistent and verifiable language specification.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.