9
GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

Page 1: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

GRAFIX: A Small Programming Language for Graphs

Suratna BudalakotiCMPS203

Page 2: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Background:

Project Aims:Develop an operational semantics for a graph language.Implement this semantics.

Motivation: Graphs are more complex than other common data structures. So I hoped to get a better idea of the language implementation process.

Page 3: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Two layered approach:

Implement a functional programming language for graphs.

Implement an imperative programming language (IMP) on top.

Page 4: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Sample Commands:

Ct( ): Create a vertex/edge. Del(): Delete vertex/edge. Srch(): Search if a vertex/edge

exists. Neigh(): Give the neighbor of a

vertex.Degree(): Give the degree of a node.

Page 5: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Other Features:

Recursive and Mutually Recursive Functions Neigh(Neigh(Neigh(x))) InNeigh(OutNeigh(InNeigh(OutNeigh("x")

))) Support for Set Operations

Union, Intersection, IsEqual

Page 6: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Other Features( cont’d)

Wildcard Search Srch(E(a,#,5)) Srch(E(#,#,8))

Variable storage area: Assign(Var, Valtype value) GetVar(Var)

Page 7: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Design Decisions:

GRAFIX commands (exp) were defined as (list exp) instead of exp;exp, for reasons of readability.

This led to problems during interfacing with IMP. Interfacing with IMP was not a total success.

Page 8: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

In Hindsight: Fortunately:

An extremely close correspondence between oCAML and operational semantics.

Unfortunately: There are serious readability issues involved

with oCaml code. A lexical analyser should have been present as a third layer. That could have prevented some unfortunate design decisions.

Page 9: GRAFIX: A Small Programming Language for Graphs Suratna Budalakoti CMPS203

Thank You