Test Post from Quality Assignment Help http://qualityassignmenthelp.com
Project Fractals and the Beauty of Nature"
Many fractals can be generated from descriptions in the Fractal Description
Language (.fdl). This language describes a start state of a fractal and a set
of rules how to progress to larger depths.
For example, to generate a Koch curve, we start with the initial (depth 0)
state F signifying a forward move, i.e., a straight line. The rule for expanding
to the next depth is given as a replacement rule.
F -> F L F R F L F
where L is a 60 degree turn to the left and R is a 120 degree turn to the right.
That is, we replace a straight line by a straight line, a left-turn, a straight
line, a sharp right-turn, a straight line, a left-turn, and a fourth and nal
straight line.
Thus, the state for depth 1 is F L F R F L F. To get to depth 2, we
have to apply the rule again to all positions of the state where it is possible,
i.e., we have to replace each of the four F by F L F R F L F. The result
is F L F R F L F L F L F R F L F R F L F R F L F L F L F R F L F
where the new sections are underlined to aid your understanding.
To get to depth 3, we would have to replace each of the 16 Fs by the right
side of the rule. For the sake of brevity, I leave this exercise to you.
Let us take a look at the le koch.fdl available from the project section
of the course home page.
start F
rule F -> F L F R F L F
length 2
depth 5
cmd F fd
cmd L lt 60
cmd R rt 120
The rst line give the start state, i.e., the
state F for depth 0. The second line give the
only rule needed for the Koch curve, i.e.,
to replace F by F L F R F L F. The third
line speci es the length of each segment, i.e.,
each straight line will be 2 units long. The
fourth line speci es that states should be ex-
panded to depth 5 before drawing the frac-
tal. Finally, the Lines 5 to 7 specify that F
is a straight line, L is a 60 degree left-turn
and R is a 120 degree right-turn.
Task 0 { Preparation
Download all the .fdl les from the course homepage (at least dragon.fdl,
fern.fdl, koch.fdl, sierpinski.fdl, sierpinski2.fdl, snowflake.fdl,
and tree.fdl.
4
Try to understand how these generate their respective fractals. If you
are new to the fractals project, have a look at the project description for
the rst part to get some inspiration. While most of the fractals are known,
dragon.fdl represents a dragon curve and sierpinski.fdl represents a
Sierpinski curve.
Task 1 { Representing and Applying Rules
A rule consists of a single letter for the left side and a list of letters for the
right side. Your task is to create a user-de ned type (= Python class) \Rule"
that represents such a rule. This class should have attributes for at least the
left side and the right side.
You also need to write a function that applies a rule to each (matching)
element of a list, i.e., that from the list ["F","L","F","R","F","L","F"] for
depth 1 of the Koch curve will generate the list [["F","L","F","R","F","L",
"F"],"L",["F","L","F","R","F","L","F"],"R",["F","L","F","R","F",
"L","F"],"L",["F","L","F","R","F","L","F"]].
Task 2 { Representing and Executing Commands
A command consists of a command string (such as fd, lt, rt, scale) and a
list of arguments. Your task is to create a user-de ned type (= Python class)
\Command" that represents a command. This class should have attributes
for at least the command string and the arguments.
You also need to write a function for executing a command. This func-
tion gets as an argument a turtle object and a length. The command with
command string lt and argument list ["60"] should execute the Python state-
ment lt(turtle, 60). The command scale multiplies the length with the
given
oat. Finally, the command nop simply does nothing (no operation).
Task 3 { Loading a Fractal Description Language File
A fractal consists of a start state represented by a list, a list of rules, a
mapping from single letters to commands, a length, and a depth.
Your task is to create a user-de ned type (= Python class) \Fractal" that
has at least the attributes described above. In addition, you should write a
function or method that executes all commands of a given state, i.e., goes
through a state list, uses the mapping from single letters to commands, and
executes these.
You also need to write a function that reads an .fdl le and creates a
Fractal object from it.
5
Task 4 { Generating Fractals
Now you are left with computing a new state from an old state. Your task is
to write a (recursive or iterative) function or method that for a given start
state, set of rules, and depth computes the state at that depth.
Finally, you have to put everything together such that you can load,
compute, and draw a fractal for a given le. To this end, you should import
the sys module and use as a lename the rst argument passed on the
command line, i.e., sys.argv[1]. You also need to write a function to
atten
the lists of lists obtained by rule applications into a list of elements those lists.
Task 5* { Support for Line Widths and Colors
The fractals look nice enough, but some colors and wider lines would make
them more pretty. Your challenge task is to extend the Fractal Descripton
language by the commands color and width where color gets a color name,
a color code or \random" as an argument while width gets a
oat. Random
colors can e.g. be generated by using format strings:
"#%02x%02x%02x" % (randint(0,255),randint(0,255),randint(0,255))
Here is an example for a nicer dragon curve:
start F X
rule X -> X R Y F
rule Y -> F X L Y
length 3
depth 13
color random
width 2.0
cmd F fd
cmd X nop
cmd Y nop
cmd L lt 90
cmd R rt 90
Note that this task is optional and does not have to
Solution Code
| Login | | | Register | | | Live Chat |
We pro
©2011. All right reserved |
| Login | | | Register | | | Live Chat |
Programming : C, C++, Java, Python, Algorithm, Lisp, Scheme, Databases, Data-structure, javascript, Perl, Fortran, Logo design, Banner design, Php, Asp.net etc Subjects: Mathematics, Mathematica, Physics, Accounts, Finance, Business, etc Other services: Data entry, Test orientation help, Online tutoring , Article writing, programming testing, Coding error correction, etc
|
©2011. All right reserved |
Lisp
Lisp QuestionThis project involves completing an interpreter for an imperative language written in a functional language--LISP. A copy of the skeleton interpreter is attached.To understand this program, it is essential to understand the program state that is carried from one statement to the next as the interpreter executes a program. Consider the sample program that was provided in the requirements:((assign x to 1) (assign y to (x * 2)) (write x) (write y))Show what is in the three-element list that contains the program state after the execution of each of the four statements in the above program.Requirements:The fourth project involves completing a LISP program hat is provided in the case study of module 5. That program interprets a simple imperative language. The skeleton version provided interprets assignment and write statements and evaluates binary expressions. The following dialog illustrates the execution of a simple program with that version.>(interpret-program '((assign x to 1) (assign y to (x * 2)) (write x) (write y)) nil)(1 2)The complete grammar of the language is provided below in extended BNF:program ::=statement_liststatement_list::=statement|({statement})statement ::=assignment_statement|write_statement|read_statement|if_statement|while_statementassignment_statement::=(assignvariable to expression)write_statement::=(writeexpression)read_statement::=(readvariable)if_statement::=(ifexpression then statement_list1else statement_list2)while_statement::=(whileexpression do statement_list)expression ::=variable|literal|(unary_operator expression) |(expressionbinary_operator expression)Nonterminals are shown in red, terminals in blue and BNF metasymbols are black. You must add the functions to interpret the read, if and while statements and the function to evaluate unary expressions and modify the necessary functions to call them. You are not required to perform any syntax checking on the input. You may assume that the programs are syntactically correct. Explicit input and output should not be used in this program. The main function should accept the input as a parameter. The output should be the value of the main function. In addition, no explicit iteration should be used, recursion must be used in its place.Answer
; main function creates state containing supplied input and empty
; memory and output, returns output
(defun interpret-program (program input)
(third (interpret-statement-list program (list '(()) input nil))))
; interprets a single statement if statement-list is a single statement
; recursively interprets all statements if it is a list
(defun interpret-statement-list (statement-list state)
(cond
((null statement-list) state)
((atom (first statement-list))
(interpret-statement statement-list state))
(t (interpret-statement-list (rest statement-list)
(interpret-statement (first statement-list) state)))))
; determines the type of statement based on the first word
; and calls the appropriate function to interpret it
(defun interpret-statement (statement state)
(cond
((eq (first statement) 'assign)
(interpret-assignment-statement (second statement)
(fourth statement) state))
((eq (first statement) 'write)
(interpret-write-statement (second statement) state))
((eq (first statement) 'read)
(interpret-read-statement (second statement) state))
((eq (first statement) 'if)
(interpret-if-statement (second statement)
(fourth statement)
(sixth statement)
state))
((eq (first statement) 'while)
(interpret-while-statement (second statement) (fourth statement)
state))))
; interprets the write statement by evaluating the expression
; and appending its value to the output stream
(defun interpret-write-statement (write-expression state)
(let
((memory (first state))
(input (second state))
(output (third state)))
(list memory input (append output
(list (evaluate-expression write-expression state))))))
; interprets the assignment statement by evaluating the expression
; and assigning the value to the specified variable
(defun interpret-assignment-statement (variable expression state)
(let
((memory (first state))
(input (second state))
(output (third state)))
(list (set-value memory variable
(evaluate-expression expression state)) input output)))
; interprets the read statement, taking first value from input list
; and assigning the value to the specified variable
(defun interpret-read-statement (variable state)
(let
((memory (first state))
(input (second state))
(output (third state)))
(list (set-value memory variable (first input))
(rest input)
output)))
; interpets the while statement, evaluating its expression and, if its
; value is true, interpeting statement list and interpeting while
; statement again.
(defun interpret-while-statement (expression statement-list state)
(let
((memory (first state))
(input (second state))
(output (third state)))
(let ((condition (evaluate-expression expression state)))
(cond
(condition
(interpret-while-statement expression statement-list
(interpret-statement-list statement-list
state)))
(t
state)))))
; interprets the if statement, evaluating its expression, and if its value
; is true, interprets true-statement-list, and false-statement-list otherwise
(defun interpret-if-statement (expression
true-statement-list
false-statement-list
state)
(let
((memory (first state))
(input (second state))
(output (third state)))
(let ((condition (evaluate-expression expression state)))
(cond
(condition
(interpret-statement-list true-statement-list state))
(t
(interpret-statement-list false-statement-list state))))))
; evaluates an expression by checking whether it is a literal, a
; variable, a binary or unary expression
(defun evaluate-expression (expression state)
(cond
((numberp expression) expression)
((atom expression) (get-value (first state) expression))
((eq (length expression) 2)
(evaluate-unary-expression expression state))
((eq (length expression) 3)
(evaluate-binary-expression expression state))))
; evaluates a binary expression by first evaluating the subexpressions
; and then applying the operator to those subexpressions
(defun evaluate-binary-expression (expression state)
(let
((left-operand (evaluate-expression (first expression) state))
(operator (second expression))
(right-operand (evaluate-expression (third expression) state)))
(apply operator (list left-operand right-operand))))
; evaluates an unary rexpression by evaluating the subexpression
; and then applying the operator to the subexpression
(defun evaluate-unary-expression (expression state)
(let
((operator (first expression))
(operand (evaluate-expression (second expression) state)))
(apply operator (list operand))))
; adds the variable-value pair to the head of the association list
; that comprises the current state of the memory. Previous
; occurences of that variable are not removed.
(defun set-value (memory variable value)
(cons (list variable value) memory))
; retrieves the value of a variable from the association list
; that comprises the current state of the memory
(defun get-value (memory variable)
(second (assoc variable memory)))| Login | | | Register | | | Live Chat |

![]() | ![]() |
| Project help and assignment help for international students via email --------------------------------------------------------------------------------------------------------------------------------------------------- | ||
| We offer assignment, project, and programming aids similar to distant learning programs in the US, UK, Australia, Canada, Europe, UAE and other countries. All you have to do is send us your questions and assignments with a specified deadline via email. We will check your assignment and will get back to you with the quote. If you accept our quote from the pay or escrow service through moneybookers.com, we will start working on the project. As soon as you receive your work and you are satisfied with the quality, you can release the full payment or pay half of it if you are a first time customer. Escrow service makes your money safe and secure. All mathematics assignments will be sent to your mail in 2 formats: in word document and scanned, handwritten copy. It is your choice as to how you want to receive the file. For programming projects, we will send the finished code after full testing which includes detailed comments and screen shots of the output as a proof. After receiving the work, you will have 1 week time to clear all your issues in case you didn't get the right results. If that is the case, you can get refund from us. After 1 week, the refund policy is considered void. In order to ensure delivery of quality work to our clients, we have devised and implemented a comprehensive Quality Assurance system. There are a number of tools and techniques which we apply to make sure that the projects, assignments and tutoring techniques we are using are of the highest quality and address the need of our audience in an effective manner. Here is a brief overview of how Quality Assurance Systems at Quality Assignment Help work to provide you the maximum value for the money you give for your projects and assignments |
|
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||
©2011. All right reserved |
Best grade in your exams , academics and projects via email
We offer assignment, project, and programming aids similar to distant learning programs in the US, UK, Australia, Canada, Europe, UAE and other countries. All you have to do is send us your questions and assignments with a specified deadline via email. We will check your assignment and will get back to you with the quote. If you accept our quote from the pay or escrow service through moneybookers.com, we will start working on the project. As soon as you receive your work and you are satisfied with the quality, you can release the full payment or pay half of it if you are a first time customer. Escrow service makes your money safe and secure.
All mathematics assignments will be sent to your mail in 2 formats: in word document and scanned, handwritten copy. It is your choice as to how you want to receive the file. For programming projects, we will send the finished code after full testing which includes detailed comments and screen shots of the output as a proof. After receiving the work, you will have 1 week time to clear all your issues in case you didn't get the right results. If that is the case, you can get refund from us. After 1 week, the refund policy is considered void.
In order to ensure delivery of quality work to our clients, we have devised and implemented a comprehensive Quality Assurance system. There are a number of tools and techniques which we apply to make sure that the projects, assignments and tutoring techniques we are using are of the highest quality and address the need of our audience in an effective manner. Here is a brief overview of how Quality Assurance Systems at Quality Assignment Help work to provide you the maximum value for the money you give for your projects and assignments:
Computer programming assignment help includes the following areas:
C++, C#, Java, Delphi, Assembly, Visual Basic, Lisp, SAP, Algorithm;
AJAX, PHP, JavaScript, HTML, ASP/ASP.net;
Silverlight, Adobe Flex, Adobe Flash, Coldfusion;
Python, Perl, Ruby/Ruby on Rails;
MS SQL, MySQL, Oracle;
MathCAD, Matlab LabVIEW, Mathematica.
All the programming Languages
Quality Assignment Help Expert offers the best programming homework help:
degree holding programming experts with years of experience in their respective fields;
at any academic levels - high school, college, or university and even masters degree levels;
payment, feedback, and contact methods are safe, secure and reliable;We provide you with safety and confidentiality. We never share your information with anyone for any reason.
Evaluation by Subject Specialists
Quality Assignment Help has a team of writers as well as experts in their respective areas of study so that we can evaluate the project with the critical eye before your instructor evaluates your project or assignment. Similarly, for the test preparation, we have experts who are adept in designing test questions and they will not only give you the exact answers at the end of each training session but will explain each and every ambiguity there is to the test!
Plagiarism Check
At Quality assignment help, we utilize the best quality plagiarism check programs available, like Turnitin, to assure that once you get your work done by Quality Assignment Help, you are sure of your success.
Review System
We offer a reviewing system which makes sure that all your projects and assignments are coherent with the given instructions. We keep a full database of each project and assignment and make sure that the task is completed according to the slightest needs, not missing a single area according to your instructions.
Project-Live-Help is one of the branches of our company which provides services in same field.
How do Compilers work? Understanding how the software works
How do Compilers work? Understanding how the software works
The compiler is a program that is used to change the source code that was written in a particular language into another language. The transformation of the source code is necessary in order to create an executable program. This is very useful nowadays since there are so many operating systems nowadays, that it is necessary to have a compiler to make it possible that the program runs on particular computers. This is known as a cross compiler. The compiler has a number of uses. It can be used to do lexical analysis, parsing, code generation, optimization and many others.
A compiler comes with different parts. They help in transforming or bridging the high level language into a machine readable code. What it does is determine if the syntax of the programs across is all correct, create an object code, organize the run time and format an output depending on conventions. It consists of a front end where semantics and syntax are checked. This is also where the type checking is being done. When the program enters the middle end, the optimization will occur and here, the useless codes are removed. The back end is used to translate the IR from the middle end. The variables will also be selected for particular registers.
Some programming languages require a compiler while others don't. One example of language that requires a compiler is PHP. JavaScript on the other hand does not require a particular compiler. With PHP, it is normally called a server based language and it has to communicate with the server on the web so that the file systems can be accessed. To do this, the compiler will transform the code with something that can be understood by the web browser. When you look at something like JavaScript, we are looking at a client based language that is executed by the browser. In this case, the browser is the compiler.
Let us look at the C and C++ and how the compiler works on them. The code cannot run on its own since it is standing on the source file. The code must be translated to something that the machine can read. What the compiler does is to check all the syntax on the program. It is being read as 1 and 0.
There are so many kinds of compilers that are being used depending on the programming language that is used by the programmer. There are compilers for Basic, C, C#, C++, Common Lisp, ECMAScript, Fortran, Haskell, Pascal, Scheme, SmallTalk, CIL and Open Source. Most of not all are available for Windows OS and a small portion to Unix types. There are open source licenses, proprietary licenses and others. It is necessary to use the one that is most appropriate for your intended use. Nonetheless, there are several active compilers that can be used. It is necessary to have a solid understanding of the compilers. This is a key piece of software that is necessary to transform your elaborate code to a functional program.
We are available 24 x 7 to help you with your assignments, projects, reports and tutoring needs. You do not need to look for the differences in time zones at all. In case you need some task to be completed urgently, we are just a few clicks away!
You can contact us through email: tutorapex@gmail.com
You can call us at skype ID : dawnin123
In case you need some immediate assistance and response, our online helpdesk is there to solve all your issues.
Do not forget to ask for you PIN number as it makes easy to track the status of your assignment and project. We identify the project or assignment with the help of this PIN number to provide post sales services efficiently.
How do Compilers work? Understanding how the software works
The compiler is a program that is used to change the source code that was written in a particular language into another language. The transformation of the source code is necessary in order to create an executable program. This is very useful nowadays since there are so many operating systems nowadays, that it is necessary to have a compiler to make it possible that the program runs on particular computers. This is known as a cross compiler. The compiler has a number of uses. It can be used to do lexical analysis, parsing, code generation, optimization and many others.
A compiler comes with different parts. They help in transforming or bridging the high level language into a machine readable code. What it does is determine if the syntax of the programs across is all correct, create an object code, organize the run time and format an output depending on conventions. It consists of a front end where semantics and syntax are checked. This is also where the type checking is being done. When the program enters the middle end, the optimization will occur and here, the useless codes are removed. The back end is used to translate the IR from the middle end. The variables will also be selected for particular registers.
Some programming languages require a compiler while others don't. One example of language that requires a compiler is PHP. JavaScript on the other hand does not require a particular compiler. With PHP, it is normally called a server based language and it has to communicate with the server on the web so that the file systems can be accessed. To do this, the compiler will transform the code with something that can be understood by the web browser. When you look at something like JavaScript, we are looking at a client based language that is executed by the browser. In this case, the browser is the compiler.
Let us look at the C and C++ and how the compiler works on them. The code cannot run on its own since it is standing on the source file. The code must be translated to something that the machine can read. What the compiler does is to check all the syntax on the program. It is being read as 1 and 0.
There are so many kinds of compilers that are being used depending on the programming language that is used by the programmer. There are compilers for Basic, C, C#, C++, Common Lisp, ECMAScript, Fortran, Haskell, Pascal, Scheme, SmallTalk, CIL and Open Source. Most of not all are available for Windows OS and a small portion to Unix types. There are open source licenses, proprietary licenses and others. It is necessary to use the one that is most appropriate for your intended use. Nonetheless, there are several active compilers that can be used. It is necessary to have a solid understanding of the compilers. This is a key piece of software that is necessary to transform your elaborate code to a functional program.
Subscribe to:
Posts (Atom)














