diff options
Diffstat (limited to 'comp/lucas-standen-NEA/writeup')
-rw-r--r-- | comp/lucas-standen-NEA/writeup/coverpage.ms | 33 | ||||
-rw-r--r-- | comp/lucas-standen-NEA/writeup/coverpage.ps | 292 | ||||
-rw-r--r-- | comp/lucas-standen-NEA/writeup/questions-for-amy.ps | 2 |
3 files changed, 184 insertions, 143 deletions
diff --git a/comp/lucas-standen-NEA/writeup/coverpage.ms b/comp/lucas-standen-NEA/writeup/coverpage.ms index 48a6071..c62c665 100644 --- a/comp/lucas-standen-NEA/writeup/coverpage.ms +++ b/comp/lucas-standen-NEA/writeup/coverpage.ms @@ -196,7 +196,6 @@ I've wanted to take out a project like this for a long long time, and this is th opportunity to do so, I will be assessing myself along the way of this, building the project to my personal specification. - .NH 2 Questionnaires .PP @@ -270,7 +269,7 @@ issue; a ballooning code-base is unlikely as only one person is writing the proj I am also taking on the fact that my client wants good command line tools, so a pkg-manager and bundler should be a priority, perhaps they could be written in Zippy after the interpreter is done. -.NH 3 +.NH 2 The first elements of the project .PP At this stage I can say that I'm confident in my project and its scope. I have a goal in mind for @@ -386,7 +385,7 @@ It will do this via AST's This prototype takes 173 lines of code, it takes a string as a cmd line argument then converts it into an abstract syntax tree, and finally it executes it. This is just a simple prototype and thus -it is small in scope. It can only do simple operators (+-*/) and requires litteral values to be +it is small in scope. It can only do simple operators (+-*/) and requires literal values to be surrounded by [] so it knows its not another expression to evaluate. https://github.com/standenboy/school/tree/master/comp/lucas-standen-NEA/code/proto/ast @@ -428,8 +427,8 @@ a real left and real right value, along side two other nodes. The real values ar would be the 2 numbers in reference in the expression. The 2 nodes are a recursive data structure, much like putting an object of a class inside the definition of that class itself. They are used to store values that may still be expressions, for example (+ [1] (+ [1] [1])) the second part of this -expression would be in the "right" vairable. When code is executed I can check if "left", or "right" -are null and if they are i know that i am at the lowest expression that is only litteral values. +expression would be in the "right" variable. When code is executed I can check if "left", or "right" +are null and if they are i know that i am at the lowest expression that is only literal values. Then I can execute that node and work my way up the tree. @@ -470,10 +469,32 @@ int exec(ast_node *exp){ } +This code will execute the operation, unless there is a deeper node, if there is a deeper node, +then it executes it, and places the result in the right or left spot respectively + +Here is an example input and output: + + ./ast "(+ (- [3] [1]) (- [3] [1]))" + + 4 + +Note the [] used to tell the program where the literal values are. -The rest of the code is the process of converting the string input to litteral values and inserting +Overall this was a relatively successful prototype, however it isn't fully functional as a language +it has fit the design. + +The rest of the code is the process of converting the string input to literal values and inserting them into the AST +.NH 3 +Feedback +.PP +From my first Client (Amy C), she said that putting the numbers inside square brackets was +inconvenient and annoying and it would be better if the numbers were separated by spaces instead of +separate square bracket surrounded literals. + +As this is a prototype I won't fix this issue, however in the actual language this is a needed +feature that I will be implementing. .NH 1 Design diff --git a/comp/lucas-standen-NEA/writeup/coverpage.ps b/comp/lucas-standen-NEA/writeup/coverpage.ps index 6cf0175..c36da3a 100644 --- a/comp/lucas-standen-NEA/writeup/coverpage.ps +++ b/comp/lucas-standen-NEA/writeup/coverpage.ps @@ -1,6 +1,6 @@ %!PS-Adobe-3.0 %%Creator: groff version 1.23.0 -%%CreationDate: Mon May 6 12:02:29 2024 +%%CreationDate: Tue May 7 15:14:41 2024 %%DocumentNeededResources: font Times-Bold %%+ font Times-Italic %%+ font Times-Roman @@ -519,202 +519,202 @@ G(he normie \214nds the completed project.)-2.5 E F1 2.5(2.5.4. Client) -2.534 F(-)-.2 E .598 (tunity to do so, I will be assessing myself along the w)111 378 R .597 (ay of this, b)-.1 F .597(uilding the project to my per)-.2 F(-)-.2 E -(sonal speci\214cation.)111 390 Q F1 2.5(2.6. Questionnair)111 438 R(es) +(sonal speci\214cation.)111 390 Q F1 2.5(2.6. Questionnair)111 426 R(es) -.18 E F0 2.133 -(It is important to get feedback from end users, so I will tak)136 453.6 +(It is important to get feedback from end users, so I will tak)136 441.6 R 4.633(em)-.1 G 2.133(ultiple questionnaires)-4.633 F .852(throughout \ the project. I will then use them to slightly edit the requirements of \ -my project this)111 465.6 R(should mak)111 477.6 Q 2.5(et)-.1 G +my project this)111 453.6 R(should mak)111 465.6 Q 2.5(et)-.1 G (he \214nal outcome more helpful and what people w)-2.5 E(ant.)-.1 E -(In the section bello)111 501.6 Q 2.5(wy)-.25 G +(In the section bello)111 489.6 Q 2.5(wy)-.25 G (ou will \214nd questionnaires from the analyses stage of my project.) --2.5 E F1 2.5(2.6.1. Questionnair)111 525.6 R 2.5(e1f)-.18 G(or Amy C) --2.75 E/F2 10/Times-BoldItalic@0 SF([30th April 2024])111.87 549.6 Q +-2.5 E F1 2.5(2.6.1. Questionnair)111 513.6 R 2.5(e1f)-.18 G(or Amy C) +-2.75 E/F2 10/Times-BoldItalic@0 SF([30th April 2024])111.87 537.6 Q (answ)3.81 E(ered by Amy)-.1 E 2.5(,s)-.37 G(ee pull request she left) --2.5 E F1 2.5(2.6.1.1. What)111 573.6 R(do y)2.5 E +-2.5 E F1 2.5(2.6.1.1. What)111 561.6 R(do y)2.5 E (ou \214nd the most important in a language? \(eg: speed, r)-.25 E -(eadability\))-.18 E F0(Speed, readability)136 589.2 Q 2.5(,d)-.65 G(eb) +(eadability\))-.18 E F0(Speed, readability)136 577.2 Q 2.5(,d)-.65 G(eb) -2.5 E(ugging ease and disk space ef)-.2 E(\214cienc)-.25 E -.65(y.)-.15 -G F1 3.167(2.6.1.2. What)111 613.2 R .667(tools ar)3.167 F 3.167(ei)-.18 +G F1 3.167(2.6.1.2. What)111 601.2 R .667(tools ar)3.167 F 3.167(ei)-.18 G .668(mportant f)-3.167 F .668(or a language to ha)-.25 F -.1(ve)-.25 G 3.168(?\().1 G .668(eg: pkg-manager)-3.168 F 3.168(,I)-.92 G .668 -(DE integra-)-3.168 F(tion\))111 625.2 Q F0 1.141(IDE inte)136 640.8 R +(DE integra-)-3.168 F(tion\))111 613.2 Q F0 1.141(IDE inte)136 628.8 R 1.141(gration \(things lik)-.15 F 3.641(et)-.1 G 1.141 (ab complete and deb)-3.641 F 1.141(ugging tools\), a package manager) -.2 F 3.64(,a)-.4 G(nd)-3.64 E (the ability to interact with the user through the command line easily) -111 652.8 Q(.)-.65 E F1 3.363(2.6.1.3. What)111 676.8 R(featur)3.363 E +111 640.8 Q(.)-.65 E F1 3.363(2.6.1.3. What)111 664.8 R(featur)3.363 E .863(es do y)-.18 F .863(ou lik)-.25 F 3.363(ef)-.1 G -.18(ro)-3.363 G 3.363(mo).18 G .863(ther languages \(eg: C')-3.363 F 3.363(sa)-.37 G(dv) --3.363 E .863(anced memory man-)-.1 F(agement, hask)111 688.8 Q(ell')-.1 +-3.363 E .863(anced memory man-)-.1 F(agement, hask)111 676.8 Q(ell')-.1 E 2.5(st)-.37 G(erse syntax\))-2.5 E F0 .26(The ability to pass the mem\ -ory reference of an object or function and a collection of b)136 704.4 R -(uilt-)-.2 E(in or standard functions lik)111 716.4 Q 2.5(e")-.1 G -(print", "split", or "sort".)-2.5 E 0 Cg EP +ory reference of an object or function and a collection of b)136 692.4 R +(uilt-)-.2 E(in or standard functions lik)111 704.4 Q 2.5(e")-.1 G +(print", "split", or "sort".)-2.5 E F1 2.5(2.6.1.4. What)111 728.4 R +(do y)2.5 E(ou want to pr)-.25 E +(ogram in this language \(eg: websites, lo)-.18 E 2.5(wl)-.1 G -2.3 -.15 +(ev e)-2.5 H 2.5(ls).15 G(ystems\))-2.5 E 0 Cg EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF(-5-)300.17 48 Q/F1 10/Times-Bold@0 SF 2.5 -(2.6.1.4. What)111 84 R(do y)2.5 E(ou want to pr)-.25 E -(ogram in this language \(eg: websites, lo)-.18 E 2.5(wl)-.1 G -2.3 -.15 -(ev e)-2.5 H 2.5(ls).15 G(ystems\))-2.5 E F0 -(Lightweight command line tools and web back ends.)136 99.6 Q F1 2.5 -(2.6.1.5. Do)111 123.6 R -.25(yo)2.5 G 2.5(ui).25 G +/F0 10/Times-Roman@0 SF(-5-)300.17 48 Q +(Lightweight command line tools and web back ends.)136 84 Q/F1 10 +/Times-Bold@0 SF 2.5(2.6.1.5. Do)111 108 R -.25(yo)2.5 G 2.5(ui).25 G (ntend to use graphics in the pr)-2.5 E(ograms y)-.18 E(ou write?)-.25 E -F0(No.)136 139.2 Q F1 2.5(2.6.1.6. W)111 163.2 R(ould y)-.75 E(ou pr) +F0(No.)136 123.6 Q F1 2.5(2.6.1.6. W)111 147.6 R(ould y)-.75 E(ou pr) -.25 E(efer a language that f)-.18 E(ocuses on ease of use, or po)-.25 E -(wer of the code?)-.1 E F0 2.5(Il)136 178.8 S(ik)-2.5 E 2.5(eag)-.1 G +(wer of the code?)-.1 E F0 2.5(Il)136 163.2 S(ik)-2.5 E 2.5(eag)-.1 G (ood balance between the tw)-2.5 E(o.)-.1 E F1 2.5(2.6.1.7. What)111 -202.8 R(wer)2.5 E 2.5(ey)-.18 G(our last 3 pr)-2.75 E +187.2 R(wer)2.5 E 2.5(ey)-.18 G(our last 3 pr)-2.75 E (ojects? \(could they ha)-.18 E .2 -.1(ve b)-.25 H -(een written in Zippy?\)).1 E F0 2.938(Aw)136 218.4 S .438 +(een written in Zippy?\)).1 E F0 2.938(Aw)136 202.8 S .438 (ebsite, a small command-line tool and a midi k)-2.938 F -.15(ey)-.1 G -.439(board \(program runs on a Raspberry).15 F(Pi Pico\).)111 230.4 Q F1 -3.391(2.6.1.8. Ho)111 254.4 R 3.391(wm)-.1 G .891(any languages w)-3.391 +.439(board \(program runs on a Raspberry).15 F(Pi Pico\).)111 214.8 Q F1 +3.391(2.6.1.8. Ho)111 238.8 R 3.391(wm)-.1 G .891(any languages w)-3.391 F .891(ould y)-.1 F .891(ou use on a single pr)-.25 F .89 -(oject? \(could Zippy be used in)-.18 F -.25(yo)111 266.4 S -(ur codebase?\)).25 E F0 2.5(It)136 282 S +(oject? \(could Zippy be used in)-.18 F -.25(yo)111 250.8 S +(ur codebase?\)).25 E F0 2.5(It)136 266.4 S (ry to use as little languages in a project as possible, so lik)-2.5 E (ely not in an e)-.1 E(xisting project.)-.15 E F1 2.5(2.6.1.9. Do)111 -306 R -.25(yo)2.5 G 2.5(uc).25 G(ar)-2.5 E 2.5(ef)-.18 G(or lo)-2.75 E +290.4 R -.25(yo)2.5 G 2.5(uc).25 G(ar)-2.5 E 2.5(ef)-.18 G(or lo)-2.75 E 2.5(wl)-.1 G -2.3 -.15(ev e)-2.5 H 2.5(lc).15 G(ontr)-2.5 E(ol, or w) -.18 E(ould y)-.1 E(ou pr)-.25 E(efer high le)-.18 E -.1(ve)-.15 G 2.5 -(la).1 G(bstractions?)-2.5 E F0 2.931(It)136 321.6 S .431(hink lo)-2.931 -F(w-le)-.25 E -.15(ve)-.25 G 2.931(lc).15 G .431(ontrol is v)-2.931 F +(la).1 G(bstractions?)-2.5 E F0 2.931(It)136 306 S .431(hink lo)-2.931 F +(w-le)-.25 E -.15(ve)-.25 G 2.931(lc).15 G .431(ontrol is v)-2.931 F .431(ery important, b)-.15 F .432(ut high-le)-.2 F -.15(ve)-.25 G 2.932 (la).15 G .432(bstractions are con)-2.932 F -.15(ve)-.4 G .432 -(nient, so a).15 F(good balance between the tw)111 333.6 Q 2.5(oi)-.1 G -2.5(sb)-2.5 G(est.)-2.5 E F1 4.181(2.6.1.10. W)111 357.6 R 1.681(ould y) +(nient, so a).15 F(good balance between the tw)111 318 Q 2.5(oi)-.1 G +2.5(sb)-2.5 G(est.)-2.5 E F1 4.181(2.6.1.10. W)111 342 R 1.681(ould y) -.75 F 1.681(ou be happy to de)-.25 F -.1(ve)-.15 G 1.681 (lop libraries f).1 F 1.681(or things that ar)-.25 F 1.68(en't alr)-.18 -F 1.68(eady imple-)-.18 F(mented \(eg: an SQL library\))111 369.6 Q F0 -(Potentially if it is simple enough to implement ne)136 385.2 Q 2.5(wt) --.25 G(hings.)-2.5 E F1 2.5(2.6.2. Notes)111 421.2 R(fr)2.5 E -(om questionnair)-.18 E 2.5(e1)-.18 G F0 2.994(Some of the k)136 436.8 R +F 1.68(eady imple-)-.18 F(mented \(eg: an SQL library\))111 354 Q F0 +(Potentially if it is simple enough to implement ne)136 369.6 Q 2.5(wt) +-.25 G(hings.)-2.5 E F1 2.5(2.6.2. Notes)111 405.6 R(fr)2.5 E +(om questionnair)-.18 E 2.5(e1)-.18 G F0 2.994(Some of the k)136 421.2 R 3.294 -.15(ey t)-.1 H 2.994(hings that I'm taking a).15 F -.1(wa)-.15 G 5.494(yf).1 G 2.995(rom this \214rst questionnaire, are my)-5.494 F .461 -(client/users initial needs and use cases. I think it')111 448.8 R 2.961 +(client/users initial needs and use cases. I think it')111 433.2 R 2.961 (sc)-.55 G .461(lear my language can be of assistance to my)-2.961 F -.842(client, Zipp)111 460.8 R 3.342(yw)-.1 G .843(ill be a good languag\ +.842(client, Zipp)111 445.2 R 3.342(yw)-.1 G .843(ill be a good languag\ e for web back ends and small command line tools, which)-3.342 F -(my client e)111 472.8 Q(xpressed interested in.)-.15 E 2.564<498c>111 -496.8 S .064(nd the f)-2.564 F .064(act my client is w)-.1 F .064 +(my client e)111 457.2 Q(xpressed interested in.)-.15 E 2.564<498c>111 +481.2 S .064(nd the f)-2.564 F .064(act my client is w)-.1 F .064 (orried by e)-.1 F -.15(xe)-.15 G .064(cutable size interesting, ho).15 F(we)-.25 E -.15(ve)-.25 G 2.564(rI).15 G .063(doubt it will be an is-) --.001 F(sue; a ballooning code-base is unlik)111 508.8 Q -(ely as only one person is writing the project.)-.1 E 2.56(Ia)111 532.8 +-.001 F(sue; a ballooning code-base is unlik)111 493.2 Q +(ely as only one person is writing the project.)-.1 E 2.56(Ia)111 517.2 S 2.56(ma)-2.56 G .06(lso taking on the f)-2.56 F .06 (act that my client w)-.1 F .06 (ants good command line tools, so a pkg-manager and)-.1 F -.2(bu)111 -544.8 S(ndler should be a priority).2 E 2.5(,p)-.65 G(erhaps the)-2.5 E +529.2 S(ndler should be a priority).2 E 2.5(,p)-.65 G(erhaps the)-2.5 E 2.5(yc)-.15 G(ould be written in Zipp)-2.5 E 2.5(ya)-.1 G -(fter the interpreter is done.)-2.5 E F1 2.5(2.6.3. The)111 580.8 R +(fter the interpreter is done.)-2.5 E F1 2.5(2.7. The)111 565.2 R (\214rst elements of the pr)2.5 E(oject)-.18 E F0 .173(At this stage I \ -can say that I'm con\214dent in my project and its scope. I ha)136 596.4 -R .472 -.15(ve a g)-.2 H .172(oal in mind).15 F(for it.)111 608.4 Q F1 -(The k)111 632.4 Q(ey things to tak)-.1 E 2.5(ea)-.1 G(way fr)-2.5 E -(om this section ar)-.18 E(e:)-.18 E(----)111 656.4 Q F0(Mak)2.5 E 2.5 +can say that I'm con\214dent in my project and its scope. I ha)136 580.8 +R .472 -.15(ve a g)-.2 H .172(oal in mind).15 F(for it.)111 592.8 Q F1 +(The k)111 616.8 Q(ey things to tak)-.1 E 2.5(ea)-.1 G(way fr)-2.5 E +(om this section ar)-.18 E(e:)-.18 E(----)111 640.8 Q F0(Mak)2.5 E 2.5 (eah)-.1 G(igh le)-2.5 E -.15(ve)-.25 G 2.5(ll).15 G (anguage with a useable set of features, to replace C in man)-2.5 E 2.5 -(ys)-.15 G(ituations.)-2.5 E F1(----)111 680.4 Q F0 -.25(Ke)2.5 G +(ys)-.15 G(ituations.)-2.5 E F1(----)111 664.8 Q F0 -.25(Ke)2.5 G (ep the language readable and easy).25 E 2.5(,w)-.65 G(ith po)-2.5 E -(werful tools a)-.25 E -.25(va)-.2 G(ilable.).25 E F1(----)111 704.4 Q +(werful tools a)-.25 E -.25(va)-.2 G(ilable.).25 E F1(----)111 688.8 Q F0(Ensure the language is well supported with tools lik)2.5 E 2.5(eap) --.1 G(kg-manager)-2.5 E(.)-.55 E 0 Cg EP +-.1 G(kg-manager)-2.5 E(.)-.55 E F1 2.5(2.8. Abstract)111 724.8 R +(data structur)2.5 E(es and ther)-.18 E 2.5(ei)-.18 G(mplementations) +-2.5 E 0 Cg EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF(-6-)300.17 48 Q/F1 10/Times-Bold@0 SF 2.5 -(2.7. Abstract)111 84 R(data structur)2.5 E(es and ther)-.18 E 2.5(ei) --.18 G(mplementations)-2.5 E F0 1.241(In lar)136 99.6 R 1.241(ger proje\ -cts, when a programmer needs a data structure that the language the)-.18 -F 3.742(ya)-.15 G(re)-3.742 E(writing in doesn')111 111.6 Q 2.5(tp)-.18 -G(ro)-2.5 E(vide, the)-.15 E 2.5(yw)-.15 G(ill need to mak)-2.5 E 2.5 -(et)-.1 G(heir o)-2.5 E(wn.)-.25 E(Bello)111 135.6 Q 2.5(wa)-.25 G +/F0 10/Times-Roman@0 SF(-6-)300.17 48 Q 1.241(In lar)136 84 R 1.241(ger\ + projects, when a programmer needs a data structure that the language t\ +he)-.18 F 3.742(ya)-.15 G(re)-3.742 E(writing in doesn')111 96 Q 2.5(tp) +-.18 G(ro)-2.5 E(vide, the)-.15 E 2.5(yw)-.15 G(ill need to mak)-2.5 E +2.5(et)-.1 G(heir o)-2.5 E(wn.)-.25 E(Bello)111 120 Q 2.5(wa)-.25 G (re a fe)-2.5 E 2.5(we)-.25 G (xamples of these data structures that C doesn')-2.65 E 2.5(ta)-.18 G -(lready pro)-2.5 E(vide.)-.15 E F1 2.5(2.7.1. Link)111 159.6 R(ed lists) --.1 E F0 .382(this is an alternati)136 175.2 R .682 -.15(ve i)-.25 H -.381(mplementation of a list, where you store some data, and the memory) -.15 F .043(address to the ne)111 187.2 R .044(xt node. Then you can mo) --.15 F .344 -.15(ve t)-.15 H .044 +(lready pro)-2.5 E(vide.)-.15 E/F1 10/Times-Bold@0 SF 2.5(2.8.1. Link) +111 144 R(ed lists)-.1 E F0 .382(this is an alternati)136 159.6 R .682 +-.15(ve i)-.25 H .381 +(mplementation of a list, where you store some data, and the memory).15 +F .043(address to the ne)111 171.6 R .044(xt node. Then you can mo)-.15 +F .344 -.15(ve t)-.15 H .044 (hrough the list by reading the data then reading the).15 F -(data of the ne)111 199.2 Q(xt node, and then repeating until the 'ne) +(data of the ne)111 183.6 Q(xt node, and then repeating until the 'ne) -.15 E(xt' part of the node is empty)-.15 E(.)-.65 E 1.106 (In C this is easy to implement as you can \214nd a memory address v)111 -223.2 R 1.105(ery easily with '&' to \214nd)-.15 F .168 -(where a bit of data is stored. I will need to use a ')111 235.2 R .168 +207.6 R 1.105(ery easily with '&' to \214nd)-.15 F .168 +(where a bit of data is stored. I will need to use a ')111 219.6 R .168 (struct', which is a bit lik)-.55 F 2.669(eac)-.1 G .169(lass in C \(ho) --2.669 F(we)-.25 E -.15(ve)-.25 G(r).15 E(you can')111 247.2 Q 2.5(ta) +-2.669 F(we)-.25 E -.15(ve)-.25 G(r).15 E(you can')111 231.6 Q 2.5(ta) -.18 G(ttach a function to it\). A simple implementation looks lik)-2.5 -E 2.5(et)-.1 G(his:)-2.5 E(typedef struct ll {)111 271.2 Q -.2(vo)136 -295.2 S(id *data; // the data of the node).2 E(ll *ne)136 319.2 Q -(xt; // the ne)-.15 E(xt node)-.15 E 2.5(}l)111 343.2 S(l;)-2.5 E .623 -(The pro')111 367.2 R 3.123(so)-.55 G 3.123(fal)-3.123 G(ink)-3.123 E +E 2.5(et)-.1 G(his:)-2.5 E(typedef struct ll {)111 255.6 Q -.2(vo)136 +279.6 S(id *data; // the data of the node).2 E(ll *ne)136 303.6 Q +(xt; // the ne)-.15 E(xt node)-.15 E 2.5(}l)111 327.6 S(l;)-2.5 E .623 +(The pro')111 351.6 R 3.123(so)-.55 G 3.123(fal)-3.123 G(ink)-3.123 E .623(ed list are the f)-.1 F .623(act that the)-.1 F 3.122(yc)-.15 G .622(an ha)-3.122 F .922 -.15(ve d)-.2 H .622 (ata appended to the start or end easily).15 F -(by changing the root node, or the ne)111 379.2 Q(xt node.)-.15 E(Link) -111 403.2 Q 1.117(ed lists ha)-.1 F 1.417 -.15(ve a f)-.2 H 1.617 -.25 +(by changing the root node, or the ne)111 363.6 Q(xt node.)-.15 E(Link) +111 387.6 Q 1.117(ed lists ha)-.1 F 1.417 -.15(ve a f)-.2 H 1.617 -.25 (ew d).15 H -.25(ow).25 G 1.117(nsides, for e).25 F 1.117 (xample you can')-.15 F 3.617(tm)-.18 G 1.417 -.15(ove t)-3.617 H 1.117 (hrough them backw).15 F 1.118(ards, and)-.1 F -(unless you store it on its o)111 415.2 Q +(unless you store it on its o)111 399.6 Q (wn, you cant \214nd the length of it in a f)-.25 E(ast w)-.1 E(ay)-.1 E -(.)-.65 E .476(In my project I w)111 439.2 R .476(ould lik)-.1 F 2.976 +(.)-.65 E .476(In my project I w)111 423.6 R .476(ould lik)-.1 F 2.976 (et)-.1 G 2.976(ou)-2.976 G .476(se link)-2.976 F .475 (ed list in the AST \(see later sections for info\), and to store)-.1 F -(lists in the language.)111 451.2 Q F1 2.5(2.7.2. Dictionaries)111 475.2 -R F0 2.749(Ad)136 490.8 S .249(ictionary is a simple data structure tha\ +(lists in the language.)111 435.6 Q F1 2.5(2.8.2. Dictionaries)111 459.6 +R F0 2.749(Ad)136 475.2 S .249(ictionary is a simple data structure tha\ t just stores, a bit of data, and a number or string)-2.749 F -(to identify it.)111 502.8 Q 2.5(Ad)5 G(ictionary lik)-2.5 E 2.5(eal)-.1 +(to identify it.)111 487.2 Q 2.5(Ad)5 G(ictionary lik)-2.5 E 2.5(eal)-.1 G(ink)-2.5 E(ed list can be implemented with a struct in c lik)-.1 E 2.5 -(es)-.1 G(o:)-2.5 E(typedef struct dict {)111 526.8 Q -.2(vo)136 550.8 S +(es)-.1 G(o:)-2.5 E(typedef struct dict {)111 511.2 Q -.2(vo)136 535.2 S (id *data; // the data of the dict).2 E(int id; // the id of the dict) -136 574.8 Q 2.5(}d)111 598.8 S(ict;)-2.5 E .462 -(In my project I think I could use a link)111 622.8 R .461 +136 559.2 Q 2.5(}d)111 583.2 S(ict;)-2.5 E .462 +(In my project I think I could use a link)111 607.2 R .461 (ed list represent a zipp)-.1 F 2.961(yv)-.1 G .461 (ariable and an ID that i can use)-3.211 F -(to identify it, this could mak)111 634.8 Q 2.5(ee)-.1 G -.15(xe)-2.65 G +(to identify it, this could mak)111 619.2 Q 2.5(ee)-.1 G -.15(xe)-2.65 G (cution f).15 E(aster as i can compare ID')-.1 E 2.5(sr)-.55 G -(ather than string v)-2.5 E(alues)-.25 E F1 2.5(2.8. Pr)111 670.8 R -(ototyping hard featur)-.18 E(es)-.18 E 2.5(2.8.1. Abstract)111 694.8 R +(ather than string v)-2.5 E(alues)-.25 E F1 2.5(2.9. Pr)111 655.2 R +(ototyping hard featur)-.18 E(es)-.18 E 2.5(2.9.1. Abstract)111 679.2 R (Syntax T)2.5 E -.18(re)-.74 G(es \(AST\) theory).18 E F0 .117 -(In a programming language man)136 710.4 R 2.617(ya)-.15 G .118 +(In a programming language man)136 694.8 R 2.617(ya)-.15 G .118 (bstract data types will be used to allo)-2.617 F 2.618(wt)-.25 G .118 -(he code to e)-2.618 F -.15(xe)-.15 G(-).15 E .967(cute, ho)111 722.4 R +(he code to e)-2.618 F -.15(xe)-.15 G(-).15 E .967(cute, ho)111 706.8 R (we)-.25 E -.15(ve)-.25 G 3.467(rI).15 G .966(think the hardest part of\ - this is an abstract syntax tree. This is a data structure)-.001 F 0 Cg -EP + this is an abstract syntax tree. This is a data structure)-.001 F .376 +(that holds the code in an ordered form that can be analysed and e)111 +718.8 R -.15(xe)-.15 G .376(cuted in a simple w).15 F(ay)-.1 E 2.876(.I) +-.65 G 2.876(ti)-2.876 G 2.876(sa)-2.876 G .084 +(tree structure, with the top node being a root and all lo)111 730.8 R +.084(wer nodes being things needed to calculate)-.25 F 0 Cg EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF(-7-)300.17 48 Q .376 -(that holds the code in an ordered form that can be analysed and e)111 -84 R -.15(xe)-.15 G .376(cuted in a simple w).15 F(ay)-.1 E 2.876(.I) --.65 G 2.876(ti)-2.876 G 2.876(sa)-2.876 G .084 -(tree structure, with the top node being a root and all lo)111 96 R .084 -(wer nodes being things needed to calculate)-.25 F .393 -(the root. It can be used not only for code b)111 108 R .393 +/F0 10/Times-Roman@0 SF(-7-)300.17 48 Q .393 +(the root. It can be used not only for code b)111 84 R .393 (ut also for mathematical e)-.2 F .394(xpressions. I think the easi-) --.15 F(est w)111 120 Q(ay to sho)-.1 E 2.5(wi)-.25 G 2.5(ti)-2.5 G 2.5 -(sv)-2.5 G(ia a mathematical e)-2.5 E(xample)-.15 E -.8(Ta)111 144 S .2 +-.15 F(est w)111 96 Q(ay to sho)-.1 E 2.5(wi)-.25 G 2.5(ti)-2.5 G 2.5 +(sv)-2.5 G(ia a mathematical e)-2.5 E(xample)-.15 E -.8(Ta)111 120 S .2 -.1(ke t).8 H(he follo).1 E 2.5(we)-.25 G(xpression for e)-2.65 E -(xample:)-.15 E(\(1 + \(10 * \(3 - \(2 * 4\)\)\)\))111 168 Q 1.6 -.8 -(We k)111 192 T(no).8 E 2.5(wt)-.25 G(hat this is equal to -49)-2.5 E -(Ho)111 216 Q(we)-.25 E -.15(ve)-.25 G 2.917(rf).15 G .417 +(xample:)-.15 E(\(1 + \(10 * \(3 - \(2 * 4\)\)\)\))111 144 Q 1.6 -.8 +(We k)111 168 T(no).8 E 2.5(wt)-.25 G(hat this is equal to -49)-2.5 E +(Ho)111 192 Q(we)-.25 E -.15(ve)-.25 G 2.917(rf).15 G .417 (or a computer this is f)-2.917 F .416 (ar harder to understand. This is because it has no understanding)-.1 F -(of order of operation)111 228 Q 1.6 -.8(To s)111 252 T(olv).8 E 2.5(et) +(of order of operation)111 204 Q 1.6 -.8(To s)111 228 T(olv).8 E 2.5(et) -.15 G(his we use an AST \(abstract syntax tree\))-2.5 E .187 -(When you solv)111 276 R 2.687(et)-.15 G .187(hat e)-2.687 F .187 +(When you solv)111 252 R 2.687(et)-.15 G .187(hat e)-2.687 F .187 (xpression you kno)-.15 F 2.687(wt)-.25 G 2.687(os)-2.687 G .187 (tart with \(2 * 4\), then 3 - the answer to that and so)-2.687 F(on)111 -288 Q 1.6 -.8(We c)111 312 T(an represent the steps as a tree lik).8 E -2.5(es)-.1 G(o:)-2.5 E 14 14 121 121 -121 121 245.5 457 PBEGIN +264 Q 1.6 -.8(We c)111 288 T(an represent the steps as a tree lik).8 E +2.5(es)-.1 G(o:)-2.5 E 14 14 121 121 -121 121 245.5 433 PBEGIN %%BeginDocument: ast.ps %!PS-Adobe-3.0 %%Creator: GIMP PostScript file plug-in V 1.17 by Peter Kirchgessner @@ -2270,35 +2270,35 @@ showpage end %%EOF %%EndDocument -end PEND 1.266(As you can see, you need to e)136 484.6 R -.25(va)-.25 G +end PEND 1.266(As you can see, you need to e)136 460.6 R -.25(va)-.25 G 1.266(luate the e).25 F 1.265(xpression in the most brack)-.15 F 1.265 -(ets \214rst, then the)-.1 F(ne)111 496.6 Q(xt, and so on, w)-.15 E -(orking you w)-.1 E(ay up)-.1 E -1.1(Yo)111 520.6 S 2.646(uc)1.1 G .146 +(ets \214rst, then the)-.1 F(ne)111 472.6 Q(xt, and so on, w)-.15 E +(orking you w)-.1 E(ay up)-.1 E -1.1(Yo)111 496.6 S 2.646(uc)1.1 G .146 (an e)-2.646 F -.25(va)-.25 G .147(luate code in a similar w).25 F(ay) -.1 E 2.647(,t)-.65 G .147 (reating each operation \(such as +-*/\) as functions, doing)-2.647 F -.002(the most deeply nested function \214rst, then w)111 532.6 R .002 +.002(the most deeply nested function \214rst, then w)111 508.6 R .002 (orking up. Each e)-.1 F .002(xpression can be represented in this)-.15 -F(tree, then to sho)111 544.6 Q 2.5(waw)-.25 G +F(tree, then to sho)111 520.6 Q 2.5(waw)-.25 G (hole program you can create a list of trees)-2.5 E/F1 10/Times-Bold@0 -SF 2.5(2.8.2. Implementing)111 580.6 R(AST')2.5 E(s)-.37 E F0 .343 -(As a prototype i will mak)136 596.2 R -5.342 2.843(ea p)-.1 H .344 +SF 2.5(2.9.2. Implementing)111 556.6 R(AST')2.5 E(s)-.37 E F0 .343 +(As a prototype i will mak)136 572.2 R -5.342 2.843(ea p)-.1 H .344 (rogram that can tak)-2.843 F 2.844(em)-.1 G .344(athematical e)-2.844 F .344(xpressions and e)-.15 F -.25(va)-.25 G(luate).25 E(them, and allo) -111 608.2 Q(wing for functions \(in the form f\(x\)\).)-.25 E -(It will do this via AST')5 E(s)-.55 E .718(This prototype tak)111 632.2 +111 584.2 Q(wing for functions \(in the form f\(x\)\).)-.25 E +(It will do this via AST')5 E(s)-.55 E .718(This prototype tak)111 608.2 R .718(es 173 lines of code, it tak)-.1 F .718 (es a string as a cmd line ar)-.1 F .717(gument then con)-.18 F -.15(ve) -.4 G .717(rts it).15 F .177 -(into an abstract syntax tree, and \214nally it e)111 644.2 R -.15(xe) +(into an abstract syntax tree, and \214nally it e)111 620.2 R -.15(xe) -.15 G .178(cutes it. This is just a simple prototype and thus it is).15 -F 1.849(small in scope. It can only do simple operators \(+-*/\) and re\ -quires litteral v)111 656.2 R 1.849(alues to be sur)-.25 F(-)-.2 E -(rounded by [] so it kno)111 668.2 Q(ws its not another e)-.25 E -(xpression to e)-.15 E -.25(va)-.25 G(luate.).25 E(https://github)111 -692.2 Q(.com/standenbo)-.4 E +F .171(small in scope. It can only do simple operators \(+-*/\) and req\ +uires literal v)111 632.2 R .17(alues to be surrounded)-.25 F +(by [] so it kno)111 644.2 Q(ws its not another e)-.25 E(xpression to e) +-.15 E -.25(va)-.25 G(luate.).25 E(https://github)111 668.2 Q +(.com/standenbo)-.4 E (y/school/tree/master/comp/lucas-standen-NEA/code/proto/ast)-.1 E -(typedef struct ast_node ast_node;)111 728.2 Q 0 Cg EP +(typedef struct ast_node ast_node;)111 704.2 Q 0 Cg EP %%Page: 8 8 %%BeginPageSetup BP @@ -2323,13 +2323,13 @@ object of a class inside the de\214nition of that class itself. The) S .08(lues that may still be e).25 F .08(xpressions, for e)-.15 F .081 (xample \(+ [1] \(+ [1] [1]\)\) the second part of this e)-.15 F(xpres-) -.15 E .533(sion w)111 480 R .533(ould be in the "right" v)-.1 F .533 -(airable. When code is e)-.25 F -.15(xe)-.15 G .533 -(cuted I can check if "left", or "right" are).15 F .61(null and if the) -111 492 R 3.11(ya)-.15 G .61(re i kno)-3.11 F 3.11(wt)-.25 G .61 -(hat i am at the lo)-3.11 F .61(west e)-.25 F .61 -(xpression that is only litteral v)-.15 F 3.11(alues. Then)-.25 F(I)3.11 -E(can e)111 504 Q -.15(xe)-.15 G(cute that node and w).15 E(ork my w)-.1 -E(ay up the tree.)-.1 E(The e)111 540 Q -.15(xe)-.15 G +(ariable. When code is e)-.25 F -.15(xe)-.15 G .533 +(cuted I can check if "left", or "right" are).15 F .749(null and if the) +111 492 R 3.249(ya)-.15 G .749(re i kno)-3.249 F 3.249(wt)-.25 G .749 +(hat i am at the lo)-3.249 F .749(west e)-.25 F .749 +(xpression that is only literal v)-.15 F 3.249(alues. Then)-.25 F(I) +3.249 E(can e)111 504 Q -.15(xe)-.15 G(cute that node and w).15 E +(ork my w)-.1 E(ay up the tree.)-.1 E(The e)111 540 Q -.15(xe)-.15 G (cution code can be seen here.).15 E(https://github)111 564 Q (.com/standenbo)-.4 E (y/school/tree/master/comp/lucas-standen-NEA/code/proto/ast)-.1 E(int e) @@ -2349,12 +2349,32 @@ BP (if \(e)131 180 Q(xp->operation == MUL\))-.15 E(return e)151 204 Q (xp->realLeft * e)-.15 E(xp->realRight;)-.15 E(if \(e)131 228 Q (xp->operation == DIV\))-.15 E(return e)151 252 Q(xp->realLeft/ e)-.15 E -(xp->realRight;)-.15 E(return 0;)136 276 Q(})111 300 Q .851 -(The rest of the code is the process of con)111 336 R -.15(ve)-.4 G .85 -(rting the string input to litteral v).15 F .85(alues and inserting)-.25 -F(them into the AST)111 348 Q/F1 10/Times-Bold@0 SF 2.5(3. Design)111 -396 R 2.5(4. T)111 420 R(echnical Solution)-.92 E 2.5(5. T)111 444 R -(esting)-.92 E 2.5(6. Ev)111 468 R(aluation)-.1 E 0 Cg EP +(xp->realRight;)-.15 E(return 0;)136 276 Q(})111 300 Q .13 +(This code will e)111 324 R -.15(xe)-.15 G .13(cute the operation, unle\ +ss there is a deeper node, if there is a deeper node, then).15 F(it e) +111 336 Q -.15(xe)-.15 G +(cutes it, and places the result in the right or left spot respecti).15 +E -.15(ve)-.25 G(ly).15 E(Here is an e)111 360 Q +(xample input and output:)-.15 E +(./ast "\(+ \(- [3] [1]\) \(- [3] [1]\)\)")113.5 384 Q(4)113.5 408 Q +(Note the [] used to tell the program where the literal v)111 432 Q +(alues are.)-.25 E(Ov)111 456 Q .447(erall this w)-.15 F .448 +(as a relati)-.1 F -.15(ve)-.25 G .448(ly successful prototype, ho).15 F +(we)-.25 E -.15(ve)-.25 G 2.948(ri).15 G 2.948(ti)-2.948 G(sn')-2.948 E +2.948(tf)-.18 G .448(ully functional as a language)-2.948 F +(it has \214t the design.)111 468 Q 1.014 +(The rest of the code is the process of con)111 492 R -.15(ve)-.4 G +1.014(rting the string input to literal v).15 F 1.014 +(alues and inserting)-.25 F(them into the AST)111 504 Q/F1 10 +/Times-Bold@0 SF 2.5(2.9.3. F)111 540 R(eedback)-.25 E F0 1.219(From my\ + \214rst Client \(Amy C\), she said that putting the numbers inside squ\ +are brack)136 555.6 R(ets)-.1 E -.1(wa)111 567.6 S 3.248(si).1 G(ncon) +-3.248 E -.15(ve)-.4 G .748(nient and anno).15 F .748(ying and it w)-.1 +F .747(ould be better if the numbers were seperated by spaces)-.1 F +(instead of seperate square brack)111 579.6 Q(et surrounded litterals.) +-.1 E F1 2.5(3. Design)111 615.6 R 2.5(4. T)111 639.6 R +(echnical Solution)-.92 E 2.5(5. T)111 663.6 R(esting)-.92 E 2.5(6. Ev) +111 687.6 R(aluation)-.1 E 0 Cg EP %%Trailer end %%EOF diff --git a/comp/lucas-standen-NEA/writeup/questions-for-amy.ps b/comp/lucas-standen-NEA/writeup/questions-for-amy.ps index 30574d2..323b9ee 100644 --- a/comp/lucas-standen-NEA/writeup/questions-for-amy.ps +++ b/comp/lucas-standen-NEA/writeup/questions-for-amy.ps @@ -1,6 +1,6 @@ %!PS-Adobe-3.0 %%Creator: groff version 1.23.0 -%%CreationDate: Mon May 6 12:02:30 2024 +%%CreationDate: Tue May 7 15:14:42 2024 %%DocumentNeededResources: font Times-Bold %%+ font Times-Roman %%DocumentSuppliedResources: procset grops 1.23 0 |