Giter Site home page Giter Site logo

thiagopbueno / pddlparser-pp Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 2.0 45 KB

Domain and problem PDDL parser in C/C++ using Flex & Bison.

License: GNU General Public License v3.0

Makefile 5.70% C++ 94.30%
planning pddl parser bison flex strips typing equality

pddlparser-pp's Introduction

pddlparser-pp

Domain and problem PDDL parser in C/C++ using Flex & Bison.

The parser uses the BNF Description of PDDL3.0 and currently supports the following :requirements :

  • :strips
  • :typing
  • :equality

Usage

$ make clean && make
$ ./pddl

usage: ./pddl [-s] [-p] <domain.pddl> <problem.pddl>

Domain and problem PDDL parser in C/C++ using Flex & Bison.
https://github.com/thiagopbueno/pddlparser-pp

OPTIONS:
 -s	enable scanning trace.
 -p	enable parsing trace.

Example

$ ./pddl data/gripper.pddl data/gripper-4.pddl

Parsing data/gripper.pddl... ok!
Parsing data/gripper-4.pddl... ok!

>> Domain(name:gripper)

Requirements: [ :strips :equality ]
Predicates: [ ROOM(?x) BALL(?x) GRIPPER(?x) at-robby(?x) at-ball(?x,?y) free(?x) carry(?x,?y) ]

Action(name:move)
>> params:[?x, ?y]
>> precond:[ROOM(?x), ROOM(?y), NOT =(?x,?y), at-robby(?x)]
>> effects:[at-robby(?y), NOT at-robby(?x)])

Action(name:pick-up)
>> params:[?x, ?y, ?z]
>> precond:[BALL(?x), ROOM(?y), GRIPPER(?z), at-ball(?x,?y), at-robby(?y), free(?z)]
>> effects:[carry(?z,?x), NOT at-ball(?x,?y), NOT free(?z)])

Action(name:drop)
>> params:[?x, ?y, ?z]
>> precond:[BALL(?x), ROOM(?y), GRIPPER(?z), carry(?z,?x), at-robby(?y)]
>> effects:[at-ball(?x,?y), free(?z), NOT carry(?z,?x)])


>> Problem(name:griper-4, domain:gripper)

Objects: [ rooma roomb ball1 ball2 ball3 ball4 left right ]

Init: [
  ROOM(rooma)
  ROOM(roomb)
  BALL(ball1)
  BALL(ball2)
  BALL(ball3)
  BALL(ball4)
  GRIPPER(left)
  GRIPPER(right)
  free(left)
  free(right)
  at-robby(rooma)
  at-ball(ball1,rooma)
  at-ball(ball2,rooma)
  at-ball(ball3,rooma)
  at-ball(ball4,rooma)
]

Goal: [
  at-ball(ball1,roomb)
  at-ball(ball2,roomb)
  at-ball(ball3,roomb)
  at-ball(ball4,roomb)
]
$ ./pddl data/gripper-typed.pddl data/gripper-4.pddl

Parsing data/gripper-typed.pddl... ok!
Parsing data/gripper-4.pddl... ok!

>> Domain(name:gripper-typed)

Requirements: [ :strips :typing ]
Predicates: [ at-robby(?r) at(?b,?r) free(?g) carry(?g,?o) ]

Action(name:move)
>> params:[?from - room, ?to - room]
>> precond:[at-robby(?from)]
>> effects:[at-robby(?to), NOT at-robby(?from)])

Action(name:pick)
>> params:[?gripper - gripper, ?obj - ball, ?room - room]
>> precond:[at(?obj,?room), at-robby(?room), free(?gripper)]
>> effects:[carry(?obj,?gripper), NOT at(?obj,?room), NOT free(?gripper)])

Action(name:drop)
>> params:[?gripper - gripper, ?obj - ball, ?room - room]
>> precond:[ball(?obj), room(?room), gripper(?gripper), carry(?obj,?gripper), at-robby(?room)]
>> effects:[at(?obj,?room), free(?gripper), NOT carry(?obj,?gripper)])


>> Problem(name:griper-4, domain:gripper)

Objects: [ rooma roomb ball1 ball2 ball3 ball4 left right ]

Init: [
  ROOM(rooma)
  ROOM(roomb)
  BALL(ball1)
  BALL(ball2)
  BALL(ball3)
  BALL(ball4)
  GRIPPER(left)
  GRIPPER(right)
  free(left)
  free(right)
  at-robby(rooma)
  at-ball(ball1,rooma)
  at-ball(ball2,rooma)
  at-ball(ball3,rooma)
  at-ball(ball4,rooma)
]

Goal: [
  at-ball(ball1,roomb)
  at-ball(ball2,roomb)
  at-ball(ball3,roomb)
  at-ball(ball4,roomb)
]

File Description

  • pddldriver.hh/pddldriver.cc: implements the client interface;
  • pddlscanner.ll: defines the scanner rules for lexical analysis;
  • pddlparser.hh: defines the parser rules for syntactical analysis;
  • main.cc: defines the tracing level and starts the parsing process.

LICENSE

Copyright (c) 2015-2017 Thiago Pereira Bueno All Rights Reserved.

pddl-parser is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

pddl-parser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with pddl-parser. If not, see http://www.gnu.org/licenses/.

pddlparser-pp's People

Contributors

thiagopbueno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vibonadia afcarl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.