Bottom-up parser and semantic analysis for the dot grammar

已取消 已发布的 Jun 13, 2014 货到付款
已取消 货到付款

Use SableCC bottom-up parsing tool to construct a parser for the dot grammar. You can find grammer at [url removed, login to view]

The parser should accept the following dot code:

digraph G {

main [shape=box];

main -> parse [weight=8];

parse -> execute;

main -> init [style=dotted];

main -> cleanup;

execute -> make_string;

init -> make_string;

main -> printf [style=bold,label="100 times"];

make_string [label="make a\nstring"];

node [shape=box,style=filled,color=".7 .3 1.0"];

execute -> compare;

}

Then use that tool to construct an intermediate representation of the input graph. The choice of intermediate representation could be a graph, tree, or basically any other representation that you want.

Need the grammar file (that you feed into your parser tool) along with some evidence that the parser tool accepts your grammar and produces a parser. Also need the code that you had to write to generate an intermediate representation (if the tool doesn't generate the parse tree or AST by itself).

Use the intermediate representation (e.g., parse tree) that either your top-down parser or your bottom-up parser generates, and perform some kind of semantic analysis. The specific type of analysis is up to you. At minimum, it should involve a well-structured tree walker navigating through the tree, applying semantic rules to the input. Examples of what you could do include:

- Check if the input graph is acyclic or not.

- Check if the input graph is a connected graph or is it in disconnected pieces.

- Is the input graph fully connected (all nodes connected to all other nodes).

- Write a shortest path algorithm that takes two nodes as input, and finds the shortest path through the graph between the two nodes.

- Assume the input graph represents a program flow graph (you may have to recreate a sample input) and calculate its cyclomatic complexity.

- Given an unordered set of A -> B; statements as input, assume the input describes a tree, and build a tree data structure from the input (this is equivalent to building an AST).

- These are just examples, you can choose something else if you want.

Turn in a description of what kind of semantic analysis you are performing, a description of the intermediate representation that your parser generates, your semantic analysis/tree walking code, and a brief description (could be a comment in the code) of basically how your analyzer does its work.

Java JavaScript Python

项目ID: #6067086

关于项目

3个方案 远程项目 活跃的Jun 18, 2014

有3名威客正在参与此工作的竞标,均价$743/小时

pintalpandey92

hello am redhet certified software engineer and i know i can do this task easily i am ready to start now have a look to my reviews thanks

$263 USD 在2天内
(5条评论)
3.0
Sibext

Предложение еще не подано

$1500 USD 在12天内
(2条评论)
0.1
xueming0723

A proposal has not yet been provided

$111USD 在1天里
(0条评论)
0.0