Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrylR committed Oct 25, 2024
1 parent cb46f6f commit 4322ae9
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions grammar/CircomParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,25 @@ pragmaDefinition
| 'pragma' 'custom_templates' ';' #PragmaCustomTemplates
;

includeDefinition
: 'include' path=STRING ';'
;
includeDefinition: 'include' path=STRING ';' ;

blockDefiniton
: functionDefinition
| templateDefinition
| busDefinition
;

functionDefinition
: 'function' name=ID '(' argNames=simpleIdentifierList? ')' body
;
functionDefinition: 'function' name=ID '(' argNames=simpleIdentifierList? ')' body ;

templateDefinition
: 'template' customGate='custom'? 'parallel'? name=ID '(' argNames=simpleIdentifierList? ')' body
;

busDefinition
: 'bus' name=ID '(' argNames=simpleIdentifierList? ')' body
;
busDefinition: 'bus' name=ID '(' argNames=simpleIdentifierList? ')' body ;

publicInputsDefinition
: '{' 'public' '[' publicInputs=simpleIdentifierList ']' '}'
;
publicInputsDefinition: '{' 'public' '[' publicInputs=simpleIdentifierList ']' '}' ;

tagDefinition
: '{' values=simpleIdentifierList '}'
;
tagDefinition: '{' values=simpleIdentifierList '}' ;

logDefinition: 'log' '(' logArgs=expressionOrStringList? ')' ;

Expand Down Expand Up @@ -93,9 +83,7 @@ componentDeclaration
| 'component' varIdentifierList
;

busDeclaration
: busHeader signalIdentifierList
;
busDeclaration: busHeader signalIdentifierList ;

componentMainDeclaration
: 'component' 'main' publicInputsDefinition? '=' ID '(' argValues=expressionList? ')' ';'
Expand All @@ -105,7 +93,7 @@ componentMainDeclaration
STATEMENTS
//////////////////////////////////////////////////////////////*/

body: '{' stmts=statments* '}';
body: '{' statments* '}';

statments
: declarations ';'
Expand Down Expand Up @@ -149,7 +137,8 @@ substitutions
expressionList: (expression ',')* expression ;

expressionListWithNames
: (name=ID ops=(ASSIGNMENT | LEFT_ASSIGNMENT | LEFT_CONSTRAINT) expression ',')* name=ID ops=(ASSIGNMENT | LEFT_ASSIGNMENT | LEFT_CONSTRAINT) expression
: (name=ID ops=(ASSIGNMENT | LEFT_ASSIGNMENT | LEFT_CONSTRAINT) expression ',')*
name=ID ops=(ASSIGNMENT | LEFT_ASSIGNMENT | LEFT_CONSTRAINT) expression
;

expression
Expand Down Expand Up @@ -217,9 +206,7 @@ idetifierAccess

arrayDimension: '[' expression ']' ;

identifierReferance
: '.' ID
;
identifierReferance: '.' ID ;

/*//////////////////////////////////////////////////////////////
PRIMITIVES
Expand Down

0 comments on commit 4322ae9

Please sign in to comment.