Assignment 2 Task 7

Benutzeravatar
Alp.traum
Mausschubser
Mausschubser
Beiträge: 85
Registriert: 3. Feb 2004 15:15
Wohnort: Darmstadt
Kontaktdaten:

Assignment 2 Task 7

Beitrag von Alp.traum »

I can't find a starting point for this task. I'm not sure where to make my modifications and what's needed to pass the test cases. Could someone please point me in the right direction?

Benutzeravatar
sewe
Sonntagsinformatiker
Sonntagsinformatiker
Beiträge: 295
Registriert: 16. Jan 2009 14:53
Kontaktdaten:

Re: Assignment 2 Task 7

Beitrag von sewe »

You could just work top-down (through the file): First, think about whether the AST union type needs extending to be able to express function application with multiple arguments. Then, do the same for the AST of function definitions. Once that is done you can think about parsing s-expressions. This process should result in F1WAE value. There are even some test cases:

Code: Alles auswählen

(test (parse '{f 1 2}) (app 'f (list (num 1) (num 2))))
Only if you pass those and have gotten a firm grasp of the ASTs to interpret should you tackle the actual interpreter procedure. (Here it's harder to give hints without spoiling too much, so I hope the above is enough to get you started. ;-))

Benutzeravatar
Alp.traum
Mausschubser
Mausschubser
Beiträge: 85
Registriert: 3. Feb 2004 15:15
Wohnort: Darmstadt
Kontaktdaten:

Re: Assignment 2 Task 7

Beitrag von Alp.traum »

I thought through it some time again, and i think i'm getting nearer now. Thanks for the pointer!

Antworten

Zurück zu „Archiv“