Skip to main content

module examples::aliases::Syntax

rascal-0.40.16
typepal-0.14.8

Usage

import examples::aliases::Syntax;

Source code

http://github.com/usethesource/typepal/src/examples/aliases/Syntax.rsc

Dependencies

extend examples::CommonLex;

syntax Program

start syntax Program = Declaration*;

syntax Type

syntax Type = "int" | "str" | Id typ;

syntax Declaration

syntax Declaration
= Type typ Id id "=" Expression exp ";"
| "struct" Id name "{" {Field ","}* fields "}" ";"
| "alias" Id name "=" Type typ ";"
;

syntax Field

syntax Field = Type typ Id name ;

syntax Expression

syntax Expression 
= Integer i
| String s
| Id use
| Expression lhs "." Id fieldName
| "new" Id name
;

syntax Keywords

keyword Keywords = "alias" | "int" | "str" | "struct" | "new";