Skip to content

[spec] Syntax for descriptor types#99

Merged
tlively merged 8 commits into
mainfrom
descriptor-type-syntax
Jul 1, 2026
Merged

[spec] Syntax for descriptor types#99
tlively merged 8 commits into
mainfrom
descriptor-type-syntax

Conversation

@tlively

@tlively tlively commented Apr 15, 2026

Copy link
Copy Markdown
Member

Add syntax for descriptor types (i.e. "desctypes"), which prefix a comptype with optional describes and descriptor clauses. Update sub type to contain a desctype instead of a comptype. Add a Desctype_ok rule and a placeholder Desctype_sub rule, but leave the full matching rules to a future change because they are rather complicated. Update the document to splice in the new rules and update the macro definitions so they render correctly.

Add syntax descriptor types (i.e. "desctypes"), which prefix a comptype with optional describes and descriptor clauses. Update sub type to contain a desctype instead of a comptype. Add a Dectype_ok rule and a placeholder Desctype_sub rule, but leave the full matching rules to a future change because they are rather complicated. Update the document to splice in the new rules and update the macro definitions so they render correctly.
@tlively tlively requested a review from rossberg April 15, 2026 00:00
@tlively tlively marked this pull request as draft April 15, 2026 00:58
@tlively

tlively commented Apr 15, 2026

Copy link
Copy Markdown
Member Author

This still needs some work.

@rossberg rossberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, mostly nits.

Comment on lines +119 to +120
syntax describes hint(show DESCRIBES %) hint(macro "%" "T%") = DESCRIBES typeuse
syntax descriptor hint(show DESCRIPTOR %) hint(macro "%" "T%") = DESCRIPTOR typeuse

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These show hints are redundant.


syntax desctype hint(desc "descriptor type") =
| describes? descriptor? comptype
hint(show % % %)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +409 to +410
def $subst_describes(DESCRIBES tu, tv*, tu*) = DESCRIBES $subst_typeuse(tu, tv*, tu*)
def $subst_descriptor(DESCRIPTOR tu, tv*, tu*) = DESCRIPTOR $subst_typeuse(tu, tv*, tu*)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to rename one of the tu.

def $free_descriptor(DESCRIPTOR tu) = $free_typeuse(tu)

def $free_desctype(dc1? dc2? ct) =
$free_list($free_describes(dc1)?) ++ $free_list($free_descriptor(dc2)?) ++ $free_comptype(ct)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
$free_list($free_describes(dc1)?) ++ $free_list($free_descriptor(dc2)?) ++ $free_comptype(ct)
$free_opt($free_describes(dc1)?) ++ $free_opt($free_descriptor(dc2)?) ++ $free_comptype(ct)

Comment on lines +156 to +162
C |- SUB FINAL? (_IDX x)* dct : OK(x_0)
-- if |x*| <= 1
-- (if x < x_0)*
-- (if $unrolldt(C.TYPES[x]) = SUB (_IDX x')* comptype')*
-- (if $unrolldt(C.TYPES[x]) = SUB (_IDX x')* dct')*
----
-- Comptype_ok: C |- comptype : OK
-- (Comptype_sub: C |- comptype <: comptype')*
-- Desctype_ok: C |- dct : OK
-- (Desctype_sub: C |- dct <: dct')*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: s/dct/desctype/g, for consistency with below

@tlively tlively marked this pull request as ready for review June 27, 2026 04:53
@tlively

tlively commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

@rossberg, please take another look. I've addressed your comments and added new content and splices to the .rst files.

@rossberg rossberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo nit

Comment on lines +119 to +120
syntax describes hint(macro "T%" "T%") = DESCRIBES
syntax descriptor hint(macro "T%" "T%") = DESCRIPTOR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These extra definitions seem odd, what's the reason? I think you should be able to inline them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to inline them.

@tlively tlively merged commit a6a87dc into main Jul 1, 2026
12 of 13 checks passed
@tlively tlively deleted the descriptor-type-syntax branch July 1, 2026 23:38
@tlively tlively mentioned this pull request Jul 1, 2026
51 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants