Skip to content

Commit 1703617

Browse files
Improve C litmus grammar (#887)
Signed-off-by: Hernan Ponce de Leon <[email protected]> Co-authored-by: Hernan Ponce de Leon <[email protected]>
1 parent 8da5474 commit 1703617

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

dartagnan/src/main/antlr4/C11Lexer.g4

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ C11AtomicStore : 'atomic_store';
77
C11AtomicXchgExplicit : 'atomic_exchange_explicit';
88
C11AtomicXchg : 'atomic_exchange';
99
C11AtomicSCASExplicit : 'atomic_compare_exchange_strong_explicit';
10-
C11AtomicSCAS : 'atomic_compare_exchange_strong';
10+
C11AtomicSCAS : 'atomic_compare_exchange_strong' | 'SCAS';
1111
C11AtomicWCASExplicit : 'atomic_compare_exchange_weak_explicit';
12-
C11AtomicWCAS : 'atomic_compare_exchange_weak';
12+
C11AtomicWCAS : 'atomic_compare_exchange_weak' | 'WCAS';
1313
C11AtomicFence : 'atomic_thread_fence';
1414
C11AtomicAddExplicit : 'atomic_fetch_add_explicit';
1515
C11AtomicAdd : 'atomic_fetch_add';

dartagnan/src/main/antlr4/LitmusC.g4

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ main
1313
;
1414

1515
variableDeclaratorList
16-
: LBrace (globalDeclarator Semi comment?)* RBrace (Semi)?
16+
: LBrace (globalDeclarator Semi comment?)* (globalDeclarator comment?)? RBrace Semi?
1717
;
1818

1919
globalDeclarator
@@ -193,6 +193,7 @@ nre locals [IntBinaryOp op, String mo, String name]
193193
| C11AtomicStore LPar address = re Comma value = re RPar # nreC11Store
194194

195195
| Ast? varName Equals re # nreAssignment
196+
| re # reAsNre
196197
| typeSpecifier varName (Equals re)? # nreRegDeclaration
197198

198199
| SpinLock LPar address = re RPar # nreSpinLock
@@ -247,6 +248,8 @@ opCompare returns [IntCmpOp op]
247248
opArith returns [IntBinaryOp op]
248249
: Plus {$op = IntBinaryOp.ADD;}
249250
| Minus {$op = IntBinaryOp.SUB;}
251+
| Ast {$op = IntBinaryOp.MUL;}
252+
| Slash {$op = IntBinaryOp.DIV;}
250253
| Amp {$op = IntBinaryOp.AND;}
251254
| Bar {$op = IntBinaryOp.OR;}
252255
| Circ {$op = IntBinaryOp.XOR;}

0 commit comments

Comments
 (0)