Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Embedded macros - the goal

 [1/2] from: reffy:ulrich at: 9-Sep-2002 21:33


To those who have had some comments on embedded macros of the Dick persuasion, I should elaborate what I am really tyring to do with them, so that our internal latent structures are hallucinating in the same universe. I implemented these embedded macros in C and found the task rather straight forward (chuckle). So I thought it would be a good test to see the robustness of Rebol and to have this capability. So here is a little more information about what I am really trying to do with the embedded macros. Would be great to see a good solution. *(EvaluateExpression) $(NamespaceLookup) %(EnvironmentVariable) @(DatabaseReference) !(CommandLine) = *(EvaluateExpression) =================== Interior content is to be executed in program space (Rebol) EXAMPLE: aa: "1" ab: "0" a: "*(aa)*(ab)" b: "*(aa)*(ab)" op: "*" print "The answer is: *(*(a)*(op)*(b)) I think" The answer is: 100 I think EXAMPLE: print "The answer is: *(a)*(op)*(b) I think" The answer is: 10*10 I think = $(NamespaceLookup) =================== Interior content is found via a namespace lookup function with interiorcontent as its argument EXAMPLE: print "The application is: $(APNAME)" The application is: MEI = %(EnvironmentVariable) =================== Interior content is environment variable looked up by function with interiorcontent as its argument EXAMPLE: print "Rebol's home directory is: %(REBOL_HOMEDIR)" Rebol's home directory is: c:\Rebol = @(DatabaseReference) =================== Interior content is database reference retrieved by function with interiorcontent as its argument split on colon delimeter. EXAMPLE: i.e. results in a query being executed -> select VV from db.tn where LN = 'ln' and VN = 'vn' print "The application home dir is: @(ncd:cfg_rtx:$(APNAME):homedir)" The application home dir is: MEI/applications = !(CommandLine) =================== Interior content is a command line to be executed and piped result replaces macro EXAMPLE: bindir: "somepath" print "myprog says: !(myprog @(ncd:cfg_rtx:$(APNAME):homedir)/*(bindir))" KESS - Keep et semple stewpid! So, you can see, I was trying to understand how to do the nested macro parsing so that I could implement these 5 types of macros. Dick

 [2/2] from: greggirwin::mindspring::com at: 10-Sep-2002 10:35


Hi Dick, I've just been lurking on this, but may try to find some time later to think more on it. My gut reaction, since you said the format can change, is to devise a format, perhaps a dialect as Andrew suggested, that takes full advantage of REBOL's ambiguous view of data and code. Let the data describe things as clearly as possible, and minimize the effort needed to load and execute it. --Gregg