This is a (very early) attempt to write a Puppet 4 compiler in C++11.
Parser status:
- Puppet 4 compliant lexer
- Puppet 4 compliant parser
- AST construction
Expression evaluator status:
- literal expressions
- variable assignment
- + operator
- - operator (binary)
- - operator (unary)
- * operator (binary)
- * operator (unary)
- / operator
- % operator
- << operator
- >> operator
- logical
and
- logical
or
- logical
not
- == operator
- != operator
- =~ operator
- !~ operator
- < operator
- <= operator
- > operator
- >= operator
- -> operator
- ~> operator
- <- operator
- <~ operator
-
in
operator - if expressions
- unless expressions
- selector expressions
- case expressions
- method call expressions
- function call expressions
- lambdas
- resource expressions
- resource metaparameters
- virtual resource expressions
- exported resource expressions
- resource defaults expressions
- resource override expressions (NYI: scope checking)
- class definition expressions
- defined type expressions
- node definition expressions
- collection expressions
- loading files from modules
- access expressions
- global scope
- local scope
- node scope
- string interpolation
- external data lookups (i.e. hiera)
- EPP support
Type system implemented:
- Any
- Array
- Boolean
- Callable
- CatalogEntry
- Collection
- Data
- Default
- Enum
- Float
- Hash
- Integer
- Class
- Numeric
- Optional
- Pattern
- Regexp
- Resource
- Runtime
- Scalar
- String
- Struct
- Tuple
- Type
- Undef
- Variant
Puppet functions implemented:
- alert
- assert_type
- contain
- create_resources
- crit
- debug
- defined
- digest
- each
- emerg
- epp
- err
- fail
- file
- filter
- fqdn_rand
- generate
- hiera
- hiera_array
- hiera_hash
- hiera_include
- include
- info
- inline_epp
- inline_template
- lookup
- map
- match
- md5
- notice
- realize
- reduce
- regsubst
- require
- scanf
- search
- sha1
- shellquote
- slice
- split
- sprintf
- tag
- tagged
- template
- versioncmp
- warning
- with
Catalog compiling status:
- Facts from files and Facter
- JSON catalog compilation from evaluation context
The output of puppetcpp
is currently just the evaluation of the given manifest files.
Eventually it will output a JSON representation of a compiled catalog.
- OSX or Linux
- GCC >= 5.0 or Clang >= 3.4 (with libc++)
- CMake >= 3.0
- Boost Libraries >= 1.57
- Facter >= 3.0
- yaml-cpp >= 0.5.1
All of the following examples start by assuming the current directory is the root of the repo.
Before building, use cmake
to generate build files:
$ mkdir release
$ cd release
$ cmake ..
To generate build files with debug information:
$ mkdir debug
$ cd debug
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
To build puppetcpp, use 'make':
$ cd release
$ make
To build puppetcpp with debug information:
$ cd debug
$ make
You can run puppetcpp from its output directory:
$ release/bin/puppetcpp <manifest>
For a debug build:
$ debug/bin/puppetcpp <manifest>
Use the --help
option for more options
You can run puppetcpp tests using the test target:
$ cd release
$ make test
For a debug build:
$ cd debug
$ make test
For verbose test output, run ctest
instead of using the test target:
$ cd release
$ ctest -V
You can install puppetcpp into your system:
$ cd release
$ make && sudo make install
By default, puppetcpp will install files into /usr/local/bin
, /usr/local/lib
, and /usr/local/include
.
To install to a different location, set the install prefix:
$ cd release
$ cmake -DCMAKE_INSTALL_PREFIX=~/puppetcpp ..
$ make clean install
This would install puppetcpp into ~/puppetcpp/bin
, ~/puppetcpp/lib
, and ~/puppetcpp/include
.
Run the following command to remove files that were previously installed:
$ sudo xargs rm < release/install_manifest.txt
To generate API documentation, install doxygen 1.8.7 or later.
$ doxygen
To view the documentation, open html/index.html
in a web browser.