Difference between revisions of "SDF3"

From MyInfoRepo
Jump to navigation Jump to search
Line 7: Line 7:
=== Definitions === <!--T:6-->
=== Definitions === <!--T:6-->


Sorts are a
Sorts are the categorization of both terminals and non-terminals. By defining something as a sort, we can use the declaration in something called productions.
A grammar of a language consists of rules aka productions to build a valid program structure.
A production consists of a sort, or sort constructor, followed by a body.
 
An example:
`sorts Expr`
`Expr = <Expr * Expr>`


=== Lexical vs Context free === <!--T:6-->
=== Lexical vs Context free === <!--T:6-->


== An example program == <!--T:6-->
== An example program == <!--T:6-->

Revision as of 18:36, 8 September 2020

Syntax Definition Formalisms 3 (SDF3) is an academic syntax definition, used for compiling languages. It is part of the Spoofax workbench.

Intro

none yet

Syntax and language basics

Formal language definitions are very much related to (context-free) grammars, as we know them from automata.

Definitions

Sorts are the categorization of both terminals and non-terminals. By defining something as a sort, we can use the declaration in something called productions. A grammar of a language consists of rules aka productions to build a valid program structure. A production consists of a sort, or sort constructor, followed by a body.

An example: `sorts Expr` `Expr = <Expr * Expr>`

Lexical vs Context free

An example program