How can number of function parameters be counted in ANTLR4?

24 views
Skip to first unread message

jade goat

unread,
Mar 8, 2018, 2:48:19 AM3/8/18
to antlr-discussion
Hi all -

 I'm trying to write a small "functional programming" language using ANTLR4.

Two of my rules are as follows - 

func_decl
    :  func_name arg_list '=' equation  ';'      //  e.g.   sqr x = x * x ; 
;

func_call
    :  func_name  arg_list  ';' 
;


In both rules, I'd like to be able to count the number of parameters being supplied to the function (so that I can test for too few or too many parameters).
So -  can ANTLR4 do this and if so, how? 

 Many thanks in advance - 
- Andy  ( jade goat ) 


Reply all
Reply to author
Forward
0 new messages