SlideShare a Scribd company logo
ANTLR v3 Overview (for ANTLR v2 users) Terence Parr University of San Francisco
Topics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Block Info Flow Diagram
Grammar Syntax header {…} /** doc comment */ kind  grammar  name ; options {…} tokens {…} scopes… action rules … /** doc comment */ rule[String s, int z]   returns [int x, int y]   throws  E   options {…}   scopes   init {…}    :     |     ;   exceptions ^(root child1 … childN) Trees Note: No inheritance
Grammar improvements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Grammar grammar SimpleParser; program : variable* method+ ; variable: "int" ID (‘=‘ expr)? ';’ ; method  : "method" ID '(' ')' '{' variable* statement+ '}' ; statement : ID ‘=‘ expr ';' | "return" expr ';' ; expr  : ID | INT ; ID  : ('a'..'z'|'A'..'Z')+ ; INT  : '0'..'9'+ ; WS  : (' '|''|'')+ {channel=99;} ;
Using the parser CharStream in = new ANTLRFileStream(“inputfile”); SimpleParserLexer lexer = new SimpleParserLexer(in); CommonTokenStream tokens = new CommonTokenStream(lexer); SimpleParser p = new SimpleParser(tokens); p.program(); // invoke start rule
Improved grammar warnings ,[object Object],[object Object],[object Object],[object Object]
Recursion Warnings a : a A | B ; t.g:2:5: Alternative 1 discovers infinite left-recursion to a from a t.g:2:5: Alternative 1: after matching input such as B decision cannot predict what comes next due to recursion overflow to c from b // with -Im 0 (secret internal parameter) a : b | B ; b : c ; c : B b ;
Nondeterminisms ,[object Object],[object Object],[object Object],a : (A B|A B) C ; a : (A+ B|A+ B) C ; t.g:2:5: Decision can match input such as "A B" using multiple   alternatives: 1, 2
Runtime Objects of Interest ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Error Recovery ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example Error Recovery int i = 0; method foo( { int j = i; i = 4 } [program, method]: line 2:12 mismatched token: [@14,23:23='{',<14>,2:12]; expecting type ')' [program, method, statement]: line 5:0 mismatched token: [@31,46:46='}',<15>,5:0]; expecting type ';' int i = 0; method foo() ) { int j = i; i = = 4; } [program, method]: line 2:13 mismatched token: [@15,24:24=')',<13>,2:13]; expecting type '{' [program, method, statement, expr]: line 4:6 mismatched token: [@32,47:47='=',<6>,4:6]; expecting set null Note: I put in two errors each so you’ll see it continues properly One token  insertion One token  deletion
Attributes ,[object Object],[object Object],[object Object],a[String s] returns [float y] : id=ID f=field (ids+=ID)+   {$s, $y, $id, $id.text, $f.z; $ids.size();} ; field returns [int x, int z] : … ;
Label properties ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule Scope Attributes ,[object Object],[object Object],method scope { String name; } : &quot;method&quot; ID '(' ')' {$name=$ID.text;} body   ; body: '{' stat* '}’ ; … atom init {… $ method .name …} : ID | INT ;
Global Scope Attributes ,[object Object],scope Symbols { List names; } {int level=0;} globals scope Symbols; init { level++; $Symbols.names = new ArrayList(); } : decl* {level--;} ; block scope Symbols; init { level++; $Symbols.names = new ArrayList(); } :  '{' decl* stat* '}’ {level--;} ; decl :  &quot;int&quot; ID ';' {$Symbols.names.add($ID);} ; *What if we want to keep the symbol tables around after parsing?
Tree Support ,[object Object],[object Object],[object Object],[object Object],[object Object]
Tree Construction ,[object Object],[object Object],[object Object],[object Object],[object Object]
Tree Rewrite Rules ,[object Object],variable :  type declarator ';' -> ^(VAR_DEF type declarator) ; functionHeader :  type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' -> ^(FUNC_HDR type ID formalParameter+) ; atom : … |  '(' expr ')' -> expr ;
Mixed Rewrite/Auto Trees ,[object Object],b : ID INT -> INT ID | INT // implies -> INT ;
Rewrites and labels ,[object Object],[object Object],forStat :  &quot;for&quot; '(' start=assignStat ';' expr ';' next=assignStat ')' block -> ^(&quot;for&quot; $start expr $next block) ; block :  lc='{' variable* stat* '}’ -> ^(BLOCK[$lc] variable* stat*) ; /** match string representation of tree and build tree in memory */ tree : ‘^’ ‘(‘ root=atom (children+=tree)+ ‘)’ -> ^($root $children) |  atom ;
Loops in Rewrites ,[object Object],[object Object],[object Object],[object Object]
Preventing cyclic structures ,[object Object],[object Object],[object Object],[object Object],*Just noticed a bug in this one ;)
Predicated rewrites ,[object Object],a : ID INT -> {p1}? ID -> {p2}? INT -> ;
Misc Rewrite Elements ,[object Object],[object Object],[object Object],b : &quot;int&quot; ( ID -> ^(TYPE &quot;int&quot; ID) | ID '=' INT -> ^(TYPE &quot;int&quot; ID INT) ) ; a : (atom -> atom) (op='+' r=atom -> ^($op $a $r) )* ;
Tree Grammars ,[object Object],[object Object],variable :  ^(VAR_DEF type ID) |  ^(VAR_DEF type ID ^(INIT expr)) ;
Code Generation ,[object Object],[object Object],[object Object]
Sample code gen templates /** Dump the elements one per line and stick in debugging *  location() trigger in front. */ element() ::= << <if(debug)> dbg.location(<it.line>,<it.pos>);<> <endif> <it.el><> >> /** match a token optionally with a label in front */ tokenRef(token,label,elementIndex) ::= << <if(label)> <label>=input.LT(1);<> <endif> match(input,<token>,FOLLOW_<token>_in_<ruleName><elementIndex>); >>
Internationalization ,[object Object],[object Object],[object Object],RULE_REDEFINITION(file,line,col,arg) ::= &quot;<loc()>rule <arg> redefinition” /* This factors out file location formatting; file,line,col inherited from * enclosing template; don't manually pass stuff in. */ loc() ::= &quot;<file>:<line>:<col>: &quot;
Runtime Support ,[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

An Annotation Framework for Statically-Typed Syntax Trees
An Annotation Framework for Statically-Typed Syntax TreesAn Annotation Framework for Statically-Typed Syntax Trees
An Annotation Framework for Statically-Typed Syntax Trees
Ray Toal
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
bolovv
 

What's hot (20)

C tutorial
C tutorialC tutorial
C tutorial
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 
Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing
 
An Annotation Framework for Statically-Typed Syntax Trees
An Annotation Framework for Statically-Typed Syntax TreesAn Annotation Framework for Statically-Typed Syntax Trees
An Annotation Framework for Statically-Typed Syntax Trees
 
Introduction to Python - Part Three
Introduction to Python - Part ThreeIntroduction to Python - Part Three
Introduction to Python - Part Three
 
Declare Your Language: Syntax Definition
Declare Your Language: Syntax DefinitionDeclare Your Language: Syntax Definition
Declare Your Language: Syntax Definition
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Module 11
Module 11Module 11
Module 11
 
Left factor put
Left factor putLeft factor put
Left factor put
 
Introduction to Python - Part Two
Introduction to Python - Part TwoIntroduction to Python - Part Two
Introduction to Python - Part Two
 
Syntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address CodeSyntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address Code
 
LEX & YACC TOOL
LEX & YACC TOOLLEX & YACC TOOL
LEX & YACC TOOL
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Core csharp and net quick reference
Core csharp and net quick referenceCore csharp and net quick reference
Core csharp and net quick reference
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
 
C# Cheat Sheet
C# Cheat SheetC# Cheat Sheet
C# Cheat Sheet
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative Practice
 
Amusing C#
Amusing C#Amusing C#
Amusing C#
 

Viewers also liked

Automated antlr tree walker
Automated antlr tree walkerAutomated antlr tree walker
Automated antlr tree walker
geeksec80
 
Antlr Conference Drools & Hibernate
Antlr Conference   Drools & HibernateAntlr Conference   Drools & Hibernate
Antlr Conference Drools & Hibernate
Alexandre Porcelli
 
Latvia - Presentation from Veronika
Latvia - Presentation from VeronikaLatvia - Presentation from Veronika
Latvia - Presentation from Veronika
brixi1
 
Social Bookmarking Introduction To Diigo
Social Bookmarking Introduction To DiigoSocial Bookmarking Introduction To Diigo
Social Bookmarking Introduction To Diigo
brosenthal
 
Innerwealth Living Inspired Magazine August Issue
Innerwealth Living Inspired Magazine August IssueInnerwealth Living Inspired Magazine August Issue
Innerwealth Living Inspired Magazine August Issue
Chris Walker
 

Viewers also liked (20)

Automated antlr tree walker
Automated antlr tree walkerAutomated antlr tree walker
Automated antlr tree walker
 
An Introduction to ANTLR
An Introduction to ANTLRAn Introduction to ANTLR
An Introduction to ANTLR
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...
 
Antlr Conference Drools & Hibernate
Antlr Conference   Drools & HibernateAntlr Conference   Drools & Hibernate
Antlr Conference Drools & Hibernate
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
White Paper Indirect Distribution
White Paper   Indirect DistributionWhite Paper   Indirect Distribution
White Paper Indirect Distribution
 
Itb Chap 08
Itb Chap 08Itb Chap 08
Itb Chap 08
 
Falcon Stor Changing The Rules Of Backup
Falcon Stor   Changing The Rules Of BackupFalcon Stor   Changing The Rules Of Backup
Falcon Stor Changing The Rules Of Backup
 
Cut Costs, Not Benefits.
Cut Costs, Not Benefits.Cut Costs, Not Benefits.
Cut Costs, Not Benefits.
 
Networking, czy ma sens?
Networking, czy ma sens?Networking, czy ma sens?
Networking, czy ma sens?
 
Latvia - Presentation from Veronika
Latvia - Presentation from VeronikaLatvia - Presentation from Veronika
Latvia - Presentation from Veronika
 
College Preparation Journey
College Preparation JourneyCollege Preparation Journey
College Preparation Journey
 
Social Bookmarking Introduction To Diigo
Social Bookmarking Introduction To DiigoSocial Bookmarking Introduction To Diigo
Social Bookmarking Introduction To Diigo
 
SocialMedia4SmallBiz_SpotOn
SocialMedia4SmallBiz_SpotOnSocialMedia4SmallBiz_SpotOn
SocialMedia4SmallBiz_SpotOn
 
2016 artigo wireless control
2016 artigo wireless control2016 artigo wireless control
2016 artigo wireless control
 
Innerwealth Living Inspired Magazine August Issue
Innerwealth Living Inspired Magazine August IssueInnerwealth Living Inspired Magazine August Issue
Innerwealth Living Inspired Magazine August Issue
 
LinkedIn for College Students
LinkedIn for College Students LinkedIn for College Students
LinkedIn for College Students
 
4088 Norris Road Energy Profile
4088 Norris Road Energy Profile4088 Norris Road Energy Profile
4088 Norris Road Energy Profile
 
Las tres hojitas
Las tres hojitasLas tres hojitas
Las tres hojitas
 
Theming Your Views
Theming Your ViewsTheming Your Views
Theming Your Views
 

Similar to Antlr V3

The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Language
zone
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
birbal
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ Advanced
Vivek Das
 
Os Vanrossum
Os VanrossumOs Vanrossum
Os Vanrossum
oscon2007
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
intelliyole
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
ujihisa
 

Similar to Antlr V3 (20)

C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Language
 
Les origines de Javascript
Les origines de JavascriptLes origines de Javascript
Les origines de Javascript
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Javascript
JavascriptJavascript
Javascript
 
Javascript
JavascriptJavascript
Javascript
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ Advanced
 
Python 3000
Python 3000Python 3000
Python 3000
 
Linq intro
Linq introLinq intro
Linq intro
 
C programming
C programmingC programming
C programming
 
Python - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave ParkPython - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave Park
 
Pointers and arrays
Pointers and arraysPointers and arrays
Pointers and arrays
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Os Vanrossum
Os VanrossumOs Vanrossum
Os Vanrossum
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
PostThis
PostThisPostThis
PostThis
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
 
Perl Presentation
Perl PresentationPerl Presentation
Perl Presentation
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 

Antlr V3

  • 1. ANTLR v3 Overview (for ANTLR v2 users) Terence Parr University of San Francisco
  • 2.
  • 3. Block Info Flow Diagram
  • 4. Grammar Syntax header {…} /** doc comment */ kind grammar name ; options {…} tokens {…} scopes… action rules … /** doc comment */ rule[String s, int z] returns [int x, int y] throws E options {…} scopes init {…} :  |  ; exceptions ^(root child1 … childN) Trees Note: No inheritance
  • 5.
  • 6. Example Grammar grammar SimpleParser; program : variable* method+ ; variable: &quot;int&quot; ID (‘=‘ expr)? ';’ ; method : &quot;method&quot; ID '(' ')' '{' variable* statement+ '}' ; statement : ID ‘=‘ expr ';' | &quot;return&quot; expr ';' ; expr : ID | INT ; ID : ('a'..'z'|'A'..'Z')+ ; INT : '0'..'9'+ ; WS : (' '|''|'')+ {channel=99;} ;
  • 7. Using the parser CharStream in = new ANTLRFileStream(“inputfile”); SimpleParserLexer lexer = new SimpleParserLexer(in); CommonTokenStream tokens = new CommonTokenStream(lexer); SimpleParser p = new SimpleParser(tokens); p.program(); // invoke start rule
  • 8.
  • 9. Recursion Warnings a : a A | B ; t.g:2:5: Alternative 1 discovers infinite left-recursion to a from a t.g:2:5: Alternative 1: after matching input such as B decision cannot predict what comes next due to recursion overflow to c from b // with -Im 0 (secret internal parameter) a : b | B ; b : c ; c : B b ;
  • 10.
  • 11.
  • 12.
  • 13. Example Error Recovery int i = 0; method foo( { int j = i; i = 4 } [program, method]: line 2:12 mismatched token: [@14,23:23='{',<14>,2:12]; expecting type ')' [program, method, statement]: line 5:0 mismatched token: [@31,46:46='}',<15>,5:0]; expecting type ';' int i = 0; method foo() ) { int j = i; i = = 4; } [program, method]: line 2:13 mismatched token: [@15,24:24=')',<13>,2:13]; expecting type '{' [program, method, statement, expr]: line 4:6 mismatched token: [@32,47:47='=',<6>,4:6]; expecting set null Note: I put in two errors each so you’ll see it continues properly One token insertion One token deletion
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Sample code gen templates /** Dump the elements one per line and stick in debugging * location() trigger in front. */ element() ::= << <if(debug)> dbg.location(<it.line>,<it.pos>);<> <endif> <it.el><> >> /** match a token optionally with a label in front */ tokenRef(token,label,elementIndex) ::= << <if(label)> <label>=input.LT(1);<> <endif> match(input,<token>,FOLLOW_<token>_in_<ruleName><elementIndex>); >>
  • 30.
  • 31.
  • 32.