This week mostly involved debugging the undefined error that was occuring during the parsing step, and adding documentation to functions and files so that I could actually understand what I was doing...there was a moment where I had to reorient myself to my own code because I could not remember exactly what I had done and what each piece of code should do, so I'm glad to have gone through and given each function a readable description. This process also helped me find the reason why my code was skipping over every other value: I was calling reader_obj.next() and reaching the end of the token list too soon, and my parser was not analyzing all of the values stored in a list. Now that the parsing issue is fixed, there's still an issue with the pr_str function that I need to correct so that the entire list is printed when typed, but I think at this point i've finished step 1. At this point, I believe I will just do a writeup on what I've accomplished so far and what the next steps would be were I to continue with this project: I don't think I will be able to implement the evaluation step in the amount of time left in the semester...
here's the output of the code as it stands now. much better than last week.
hypatia@Yours-MacBook-Air:/mal/javascript$ node step1_read_print.js
user> hello
Debug: Tokens = hello,
token = hello
Typeof token is function
read_form returns function toString() { [native code] }
undefined
user> 1
Debug: Tokens = 1,
token = 1
read_form returns 1
undefined
user> (1 2 3)
Debug: Tokens = (,1, 2, 3,),
token = 1
token = 2
token = 3
read_form returns 3
undefined
user> (1 2 (3 4 (5 6 7)))
Debug: Tokens = (,1, 2, (,3, 4, (,5, 6, 7,),),),
token = 1
token = 2
token = (
token = 3
token = 4
token = (
token = 5
token = 6
token = 7
read_form returns 7
undefined
user> ^D
hypatia@Yours-MacBook-Air:/mal/javascript$
We mentioned the kingdom of nouns.
In the news this week : Camille Paglia.
last modified | size | ||
finalprojectprogramminglanguages.pdf | Mon Nov 25 2024 10:30 am | 31K | |
printer.js | Mon Nov 25 2024 10:30 am | 1.0K | |
reader.js | Mon Nov 25 2024 10:30 am | 3.9K | |
step0_repl.js | Mon Nov 25 2024 10:30 am | 2.4K | |
step1_read_print.js | Mon Nov 25 2024 10:30 am | 3.2K |