[antlr-interest] Code Generation

mzukowski at yci.com mzukowski at yci.com
Tue Feb 10 08:49:25 PST 2004


You could emit code from your grammar directly, but usually you want more
information than just what you are parsing at the moment.  ANTLR's trees
really shine here.  A typical compiler parses into trees and then has
multiple passes over the trees to analyze and optimize the code.  The last
pass then generates the code for output.

Monty

-----Original Message-----
From: shomi_mahima [mailto:shomi_mahima at yahoo.com] 
Sent: Tuesday, February 10, 2004 1:26 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Code Generation

Hi there,

Iam a new user of ANTLR.I have planned to design a compiler and am 
using ANTLR for generating the parser and the scanner.Could some one 
tell me whether embedding code in the grammar file  (that emits 
Intermediate code of a virtual machine) is possible while writing 
semantic actions in the grammar file.

1.  i wanna know whether embedding all the semantic checking  as well 
as code generation in the grammar file is possible
2.if possible how can one do that?(Please provide some links to some 
example).I have studied many text books which suggests using LALR 
parser for code generation
3. Since it is a LL parser will i get struck in the middle of the 
development?
4.It is mentioned that if some rules have common left prefixes

  say for eg) PR : "return"
              PRV : "ret"
here i have to make three look aheads.If supposei have two rules that 
are similar in many characters, is it advisable to increase the 
lookahead size?Is there any other way out?

Please help me
Thanx in advance
Shomi 




 
Yahoo! Groups Links



 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list