wynnliam / dep Goto Github PK
View Code? Open in Web Editor NEWA small programming assignment I had when I applied for an internship last year.
A small programming assignment I had when I applied for an internship last year.
Liam Wynn, 5/11/2017, dep dep is an interesting project. It is basically an interview question I got. I am supposed to finish this by the 16th of this month, but I sincerely doubt I will. Nonetheless, I'd like to do this project because it is a great learning experience. Here is the question, as presented to me. The program should be called dep. It should take two arguments: the path of a configuration file and a target name. The program should output the tree of dependencies for the target. The grammar of the config file is: File = FilePiece* FilePiece = Comment | BlankLine | IncludeLine | Target Comment = /#[^\n]*\n/ BlankLine = /\s*\n/ IncludeLine = 'include' /\s+/ Path '\n' Path = /"/'/'? PathComponent ('/' PathComponent)* PathComponent = /\w+/ Target = 'target' /\s+/ TargetName '\n' DependencyLine* BlankName DependendcyLine = 'depends on' /\s+/ TargetName '\n' Given the following config files: 1. (/main.conf) # This is a comment include "sub1/sub1.conf" include "sub2/sub2.conf" target main depends on foo depends on bar target x depends on foo target y depends on bar depends on baz target z depends on zprime 2. (/sub1/sub1.conf) include "sub11/sub11.conf" target foo depends on foo1 depends on foo2 target foo1 target zprime depends on waldo 3. (/sub2/sub2.conf) target bar depends on bar1 target bar1 target baz 4. (sub1/sub11/sub11.conf) target foo2 The outputs should be as follows: #dep main.conf main main(foo(foo1, foo2), bar(bar1)) dep main.conf y y(bar(bar1), baz) dep main.conf z target z(zprime(waldo)) not foind (/sub1/sub1.conf:10)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.