Skip to content

Filename extensions

Frederic Ye edited this page Sep 3, 2012 · 3 revisions

Filename extensions

This appendix lists the different filename extensions you can meet in an Opa project, with a short description of the nature of the corresponding file or directory.

This part describes for each kind of file in an Opa project :

  • a description of the file, meaning what kind of file it is, and what it contains ;
  • an output section, documenting what tool/application produces these files ;
  • an input section, documenting what tool or what application actually reads these files

api

Description

api files are text files using a json syntax for encoding the types informations extracted from Opa files, associated to their positions in the source code.

Produced by

For each opa file, there can be one corresponding api file, generated by the opa compiler using the option --api

user@computer:~/$ ls
bar  foo.opa

user@computer:~/$ ls bar
bar.opa

user@computer:~/$ opa --api bar/bar.opa foo.opa

user@computer:~/$ ls
bar  foo.api  foo.opa  foo.exe

user@computer:~/$ ls bar
bar.api  bar.opa

api-txt

Description

These files are text files written using the Opa classic syntax, containing the inferred types of toplevel elements of a corresponding Opa file. They contain a subset of the information contained in a api file, but in an human readable syntax (opa rather than json).

Produced by

Same than api files, generated by opa with the option --api

Used by

Meant to be read by an human, e.g. for debugging.

conf

Description

Configuration of packages for building medium and large applications. These files are used for setting the package organisation of an application, without editing the source files. Their utilisation is optional. It offers a functionality equivalent with the keyword import and package of the Opa syntax.

Produced by

Hand written by an author of an opa application.

Input

opa

Syntax

Commented line starts with a sharp character '#'. Then it follows the entry point packages of this grammar :

:: packages <- package list

package <- $package_name ":" entry list

entry <- import / source

import <- "import" package_entry

source <- $filename

package_entry <- $package_name / $extension_package_name

TIP: About filename

  • Relative path of filenames are given from the emplacement of the conf file itself
  • It is possible to refer to environment variables in a conf file

TIP: About package_name

They follows the same conventions as the import construct in Opa, but no spaces are allowed using the extension syntax, as in these examples: examples:

import stdlib.* import toto.{foo,bar}

Example

Here is a small example:

# a first package, with 2 files
my_package:
  import toto.{foo,bar}
  relative/path/to/myfile.opa
  relative/path/to/myotherfile.opa

# a second package, importing the first one
my.other.package:
  import my_package
  path/to/some_file.opa

jsconf

Description

conf for bsl js files, Cf part about plugin for the syntax of these files

Produced by

Hand written by the author of a js plugin.

Used by

opa-plugin-builder

opa

Description

This is the extension of the Opa files. Most of the files in an Opa project are .opa files

Produced by

Hand written by authors of an Opa application.

Used by

opa

opack

Description

opack files are used to group the command line options and arguments for invoking opa to build an Opa application.

Example:
user@computer:~/$ opa myproject.opack

is almost equivalent to

user@computer:~/$ cat myproject.opack | grep -v '#' | xargs opa

Produced by

Hand written by authors of an Opa application.

Used by

opa

Syntax

This is a file where lines correspond to argument or options of the opa compiler. Lines may be commented with #, and it is possible to refer to environment variables in a conf file

Example
# This is an example of opack file
myfile_1.opa
myfile_2.opa
--warn-error root

opp

Description

opp stands for OPa Plugin. An opp is a directory containing object files and compiled code, for building an Opa application using external primitives written directly in JavaScript.

Produced by

opa, opa-plugin-builder

Used by

opa, opa-plugin-browser

opx

Description

An opx is a directory containing object files and compiled code from a Opa package. For each Opa package correspond one opx directory once compiled by opa. Some opx files are distributed with opa, these are the compiled packages of the standard library.

Produced by

opa

Used by

opa