add a basic formal definition of the source language #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add the first version of a formal definition for the source language, covering the tree grammar and the static semantics. The definition is expressed using a macro DSL.
Details
The source language specification only provides an informal definition of the language, making it inaccessible to programs and formal reasoning.
Having a formal definition of the source language would allow for formal reasoning about programs, which in turn allows for proving that some program has a certain meaning and/or behaviour.
A macro DSL (
language
) is used for expressing the language definition. This:The macro parses and validates the meta language and translates it into an internal data structure. Planned - but not yet implemented - usages of this data are:
passtool
functionality)At the moment, the
language
macro is still missing a way to define operational semantics (i.e., a formal definition of how a program written in the source language is evaluated).The idea is to keep the formal definition and specification side-by-side until everything in the specification can be expressed with the
language
macro, at which point the specification would be removed.To-Do
def.nim
intokoch
and CINote For Reviewers