Layout definition language draft, updated

John Rose john.r.rose at oracle.com
Thu Aug 17 05:29:13 UTC 2017


I updated the LDL proposal (now over a year old).
I improved some of the exposition and formatting,
added some internal links, and put in a combined
grammar summary at the end.

  http://cr.openjdk.java.net/~jrose/panama/minimal-ldl.html

FTR, the grammar summary is included here.

Enjoy!

— John

layout = ( element )*
simple_element = atom | group | prefixed_element
element = simple_element | annotated_element

WS = ( ONE_OF[" \t\n"] )*
S = ( WS | comment )*

annotated_element = simple_element annotations
annotations = ( S annotation )+
annotation = name_only_annotation
        | "(" WS annotation_name WS "=" WS annotation_value WS ")"
name_only_annotation = "(" WS annotation_name WS ")"
annotation_name = ( ONE_OF[JAVA_IDENTIFIER_PART] )+
annotation_value = ( NOT_ONE_OF["()"] | "(" annotation_value ")" )*
prefix_annotation = ONE_OF["SUFPVAM"]

prefixed_element = replication | alignment | reversal |
        padding | kind | container | byte_swap
replication = count_prefix S simple_element
alignment = ( count S )? "%" S simple_element
reversal = "-" S simple_element
padding = "x" S simple_element
kind = prefix_annotation simple_element
container = "c" S memory_element ( S container_layout )?
byte_swap = ( ">" | "<" ) S simple_element

count_prefix = count ( S annotations )? ( S count_direction )?
count_direction = "-" | "+" | "+-"
count = numeral | incomplete_count
numeral = "0" | positive_numeral
positive_numeral = ONE_OF["1-9"] ( ONE_OF["0-9"] )*

memory_element = simple_element
container_layout = "=" S simple_element

group = "[" S ( group_body S )? "]"
group_body = element ( S element )+ | singleton | alternatives
singleton = group | parenthesis
parenthesis = "[" S element BUT_NOT[group] S "]"

alternatives = ( alternative S )+ ( element S )*
alternative = sized_alt | unsized_alt
sized_alt = ( element S )+ "|"
unsized_alt = ( element S )+ "||"

atom = bit | parenthesis | abbreviation | incomplete_element
bit = "b"
abbreviation = ONE_OF["ohwdq"]
incomplete_element = "$"
incomplete_count = "*"

comment = "#" ( NOT_ONE_OF["\n"] ( "\n" | EOF ) )*


More information about the panama-dev mailing list