Adore2Facts Compiler

  • Objective: Transform an Adore code into its associated representation in the logical facts model.
  • Requirements: java (≥ 1.5), bash-like shell

The main goal of Adore is not to provide an efficient and pretty compiler. This tools allows designer to express processes using a simple language, instead of using the underlying raw logical model.

We're aware that the implementation of this compiler is quick'n dirty.

Compiler Design

The compiler will transform a code written using the ADORE Textual DSL into a valid Prolog code (according to the facts).

It uses as input a file name containing the Adore code. The compiler prints on its standard output the associated facts representation.

Using the Compiler

We'll consider here the following fragment, written in a fragment.adore file:

fragment f {
  variables  { in as struct; out as struct; }
  activities { h. out := hook(in);}
  relations  { ^ < h; h < $;}
}

To invoke the compiler, you just have to invoke the adore2facts.sh bash script:

mosser@asmodeus:~$ adore2facts.sh fragment.adore > fragment.pl

Here is the content of the fragment.pl file, containing the associated prolog facts:

:- 
        createProcess(f),
        setAsFragment(f),
        createActivity(f_preds),
        setActivityKind(f_preds,predecessors),
        setContainment(f_preds,f),
        createActivity(f_succs),
        setActivityKind(f_succs,successors),
        setContainment(f_succs,f),
        createVariable(f_in),
        setVariableType(f_in,struct),
        traceRename(variable,in,f_in,compile(f)),
        createVariable(f_out),
        setVariableType(f_out,struct),
        traceRename(variable,out,f_out,compile(f)),
        createActivity(f_h),
        setActivityKind(f_h,hook),
        addAsInput(f_in,f_h),
        addAsOutput(f_out,f_h),
        setContainment(f_h,f),
        traceRename(activity,h,f_h,compile(f)),
        defWaitFor(f_h,f_preds),
        defWaitFor(f_succs,f_h).

Compiling the compiler ...

  • Step 1: download Adore ''sources''
  • Step 2: go to the Adore antlr sub-directory
mosser@asmodeus:~/tmp$ cd $ADORE_HOME
mosser@asmodeus:~/repositories/adore$ cd antlr
  • Step 3: run the build.sh script
mosser@asmodeus:~/repositories/adore/antlr$ ./build.sh 
####
## Generating Java Source file
## Compiling generated Java Code
## Creating JAR file
####
mosser@asmodeus:~/repositories/adore/antlr$
tools/compiler/start.txt · Last modified: 2010/02/07 21:13 by mosser
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0