Skip to content

Commit

Permalink
asm: Add support for metadata definitions.
Browse files Browse the repository at this point in the history
Now capable of parsing c4.ll.

Now capable of parsing sqlite3.ll, except for fence instructions.

Updates #15.
  • Loading branch information
mewmew committed Mar 30, 2017
1 parent 5a44261 commit b6f515f
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions asm/internal/ll.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ attr_group_id
: '#' _id
;

// --- [ Metadata identifiers ] ------------------------------------------------

metadata_name
: '!' _name
;

metadata_id
: '!' _id
;

// === [ Integer literals ] ====================================================

// Integer [-]?[0-9]+
Expand Down Expand Up @@ -183,6 +193,8 @@ TopLevelDecl
| FunctionDecl
| FunctionDef
| AttrGroupDef
| NamedMetadataDef
| MetadataDef
;

// === [ Source filename ] =====================================================
Expand Down Expand Up @@ -403,6 +415,52 @@ OptAllocSizeNElems
: "," int_lit
;

// === [ Metadata definitions ] ================================================

NamedMetadataDef
: MetadataName "=" "!" "{" MetadataIDs "}" << nil, nil >>
;

MetadataIDs
: empty
| MetadataIDList
;

MetadataIDList
: MetadataID
| MetadataIDList "," MetadataID
;

MetadataDef
: MetadataID "=" OptDistinct Metadata << nil, nil >>
;

OptDistinct
: empty
| "distinct"
;

Metadata
: "!" "{" MetadataNodes "}"
;

MetadataNodes
: empty
| MetadataNodeList
;

MetadataNodeList
: MetadataNode
| MetadataNodeList "," MetadataNode
;

MetadataNode
: Metadata
| MetadataID
| "!" string_lit
| Type Value
;

// === [ Identifiers ] =========================================================

GlobalIdent
Expand All @@ -421,6 +479,14 @@ AttrGroupID
: attr_group_id
;

MetadataName
: metadata_name
;

MetadataID
: metadata_id
;

// === [ Types ] ===============================================================

Type
Expand Down

0 comments on commit b6f515f

Please sign in to comment.