develooper Front page | perl.recdescent | Postings from October 2004

help: defining grammer?

Thread Previous | Thread Next
From:
Prentice, Phillip R
Date:
October 25, 2004 16:10
Subject:
help: defining grammer?
Message ID:
0900DAC19AE74A4582F858159B13D3D10CEB9AF3@fmsmsx406.amr.corp.intel.com
Hello,

 

I was wondering if anyone could help me begin to write some grammer for
a conversion project.  I basically have a generic language where
variables, arrays, and hash's are defined.  I want these variables to be
translated to a tool specific datastructure, i.e TCL, scheme, etc.  I am
assuming I would have to create a different set of grammar(s) for each
language I want the variables translated to.  However, I am having
trouble defining the grammar for parsing the genericLanguange.  Could
you help me get started by showing me how I would go about parsing the
below 3 structures in the GenericLangauge section below.  I would
appreciate any insight or suggestions.

 

Thanks in advance,

-Phillip

 

e.g. for example

 

__GenericLanguage__

 

$var = 10

$var1 = "variable1"

@var2 = [1,2,3]

%var3 = {'key1'=>'value1', 'key2'=>'value2}

 

__Translate-to-SchemeLanguage__

 

Define var1 = variable1

Define var2 = '(1 2 3)

...

 

__Translate-to-TCLLanguage__

 

Set var1 variable

 


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About