[plt-scheme] How get enviroment

From: wwall (wwall at yandex.ru)
Date: Thu Apr 19 01:32:30 EDT 2007

Hello Robby,

Tuesday, April 17, 2007, 6:02:40 PM, you wrote:
full code

  (define l-1C-parser
  (parser
    (tokens regularToken keyWords)
    (start MODULE)
    (end EOF)
     (error (lambda (tok-ok tok-name tok-value start-pos end-pos) (raise-read-error (format "Error Parsing YACC grammar at token: ~a with value: ~a at pos (~a,~a) " tok-name tok-value (position-line start-pos) (position-col start-pos)) (file-path) (position-line start-pos) (position-col start-pos) (position-offset start-pos) (- (position-offset end-pos) (position-offset start-pos)))))
    
    (grammar
      (MODULE ((VARSDEF FUNCDEFS COMMANDS) (make-l-1C:module  $1 $2 $3)))
      
      (VARSDEF ((VARSDEF1) $1) (() #f))
      (VARSDEF1 ((VARSDEF2) $1) ((VARSDEF1 VARSDEF2) (append  $1  $2)))
      (VARSDEF2 ((lxmVAR VARS lxmENDL)  $2))
      (VARS ((VAR) (list $1)) ((VARS lxmCOMMA VAR) (append  $1 (list $3))))
      (VAR
       ((lxmID)  `(apply append-var moduleScope (apply create-var ,$1)))
       ((lxmID lxmEXPORT) `(append-var moduleScope (create-var ,$1)))
       ((lxmID lxmSLBRANCH lxmNUMBER lxmSRBRANCH) 
        `(append-var  moduleScope (create-array ,$1 ,$3)))
       ((lxmID lxmSLBRANCH lxmNUMBER lxmSRBRANCH lxmEXPORT) 
        `(append-var  globalScope (create-array ,$1 ,$3))))
      )))

      
(define parsedStr (l-1C-parser (make-lexer test1str)))
(define Xx  (l-1C:module-scope parsedStr))
 (define globalScope (create-scope "Global" null))
 (let
     ((moduleScope (create-scope "ModuleScope" globalScope)))
      (map (lambda (x)
      (eval x))
      Xx)
   )


I don't know how correct error on eval

      

RF> This code seems hopelessly broken, or perhaps designed for use in
RF> another Scheme system.

RF> Maybe you can tell us more about what you're doing or where you got that code?

RF> Robby

RF> On 4/17/07, wwall <wwall at yandex.ru> wrote:
>> Hello plt-scheme,
>>
>>   I have code
>> (define Z '((append-var moduleScope "x1")
>>  (append-var globalScope (create-var "???????"))
>>  (append-var moduleScope (create-var "??4"))
>>  (append-var globalScope (create-var "??????1")))
>> )
>> (define globalScope (create-scope "Global" null))
>> (let
>>     ((moduleScope (create-scope "ModuleScope" globalScope)))
>>      (map (lambda (x)
>>      (eval x))
>>      Z)
>>   )
>>
>> but on (eval x) i have error - reference to undefined identifier:
>> moduleScope
>> How I can correct this mistake?
>> --
>> Best regards,
>>  wwall                          mailto:wwall at yandex.ru
>>
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>> 



-- 
Best regards,
 wwall                            mailto:wwall at yandex.ru



Posted on the users mailing list.