Граф коммитов

279 Коммитов

Автор SHA1 Сообщение Дата
Adam Sapek f63159172a Add unit tests comparing AST from .json and .bond 2015-03-31 22:46:31 -07:00
Adam Sapek 48e1a55847 Simplify the JSON representation of AST 2015-03-31 22:46:29 -07:00
Adam Sapek 0944a12502 Improve errors when parsing invalid schema AST file 2015-03-24 03:38:55 -07:00
Adam Sapek c921a23cd0 Add support for using schema AST as compiler input
File(s) with the `.json` extension are assumed to contain the JSON
representation of schema abstract syntax tree in the format produced by
`gbc schema`
2015-03-20 03:21:57 -07:00
Adam Sapek 8555e498c4 Remove helper functions to modify MappingContext 2015-03-20 02:19:24 -07:00
Adam Sapek f7020b0d8f Customize JSON representation of Default 2015-03-20 02:19:23 -07:00
Adam Sapek 860c1084fd Hide parser environment and ReaderT behind parseBond 2015-03-20 02:19:20 -07:00
Adam Sapek 5881640769 Use standalone deriving Generic declarations
The Generic instance is needed only to derive generic implementations of
FromJSON and ToJSON typeclasses so we move the declarations to
Schema/JSON.hs and only derive Generic for data types that need it.
2015-03-20 02:19:19 -07:00
Adam Sapek ff01c24556 Add round-trip unit test for AST JSON representation
Derived show typeclass for schema types in order to support QuickCheck.
Added custom ShowPretty typeclass for printing Declarations in parser
error messages. Implemented custom JSON parsing for types that had
custom JSON serialization.
2015-03-20 02:19:18 -07:00
Adam Sapek e30c89854b Reduce code duplication around codegen 2015-03-20 02:19:16 -07:00
Adam Sapek 45a37d5bde Add compiler support for schema AST output
The schema AST is written in JSON format. We foresee two classes of
scenarios that will use it.

Tools that need to process Bond schema files using languages other than
Haskell can avoid recreating Bond parser. Example might be schema
repositories, lints, etc.

The schema AST will also be used to allow users to inject schema
transformations into codegen process. This in many cases can be a
lightweight alternative to custom codegen.
2015-03-20 02:19:15 -07:00
Adam Sapek f13b706f9b Improve parser error handling for user defined types 2015-03-20 02:19:14 -07:00
Adam Sapek c2adfae6ee Separate schema data definitions and helper functions 2015-03-19 01:30:29 -07:00
Adam Sapek f710ceb39f Add test suite to Bond compiler 2015-03-19 01:30:28 -07:00
Adam Sapek 2450f5fb73 Define type alias for mapping parsers 2015-03-05 00:46:12 -08:00
Adam Sapek a852f6a36b Merge branch 'qnikst-warning-cleanup' 2015-03-05 00:45:51 -08:00
Alexander Vershilov 312be3b73a Fix warnings in the Bond compiler code 2015-03-04 23:56:40 -08:00
Adam Sapek 1e3653a8dc Add comment explaining negative value for jobs number 2015-02-27 01:07:13 -08:00
Adam Sapek c764d993e0 Avoid parsing the same import multiple times
In some scenarios the hierarchy of schemas may be very interconnected
and redundant parsing of the same imported files is a huge performance
overhead for code generation (this change showed 20x improvement when
compiling a sample set of ~900 interconnected schemas).
2015-02-12 12:16:12 -08:00
Adam Sapek 0c4d4ad4fd Add --jobs option to gbc
When compiling multiple .bond files at once, the `--jobs=[NUM]` command
line option can be used to specify how many jobs should be run
concurrently. When used without arguments, the default is to run as many
jobs as there are processors. The option also accepts negative numbers
to specify fewer jobs than the number of processors. Often the optimal
performance is achieved by leaving one or more cores for other processes
on the machine.
2015-02-12 12:16:08 -08:00
Adam Sapek 4bd6d042b8 Update appveyor.yml for the open source plan
Made the following changes for the open source AppVeyor plan which
runs on very slow and memory limited VMs:
- Limit ghc heap size to 192MB when installing dependencies
- Use `appveyor DownloadFile` instead `Start-Download`
- Download Boost in the smaller 7Zip format
- Cache cabal sandbox and boost download
- Disable C++ build
2015-02-05 19:03:53 -08:00
Adam Sapek 546499996d Relax cabal version requirement to 1.18+
The cabal version 1.20+ was required only for the --required-sandbox
flag. However since the make files are setting up the sandbox we know
that we are always building using sandbox. The current Haskell Platform
comes with cabal 1.18 so this way installing cabal update is not needed.
2015-02-03 21:16:11 -08:00
Adam Sapek f01eed1e08 Fix symbol lookup logic in the parser
This change fixes a bug in lookup of an unqualified symbol from an
imported schema file when one of the files is using a language specific
namespace. Language specific namespaces are not documented and their
use is not recommended, but the compiler supports them for backward
compatibility with legacy code.
2015-01-20 13:49:16 -08:00
Adam Sapek 761704514e Propagate cabal failures to the calling cmake script 2015-01-20 12:57:48 -08:00
Adam Sapek 389f7428a8 Fix parsing of enum default values starting with L
The bug in the parser caused it to interpret any default value starting
with the letter L as a string literal, resulting in a parsing error for
constructs like:

    struct Foo
    {
        0: Verbosity verbosity = Low;
    }
2015-01-19 15:45:32 -08:00
Adam Sapek fa37e7beda Merge pull request #9 from dnmiller/cmake-fix
Fix compiler CMake permissions for OSX
2015-01-12 17:51:44 -08:00
Adam Sapek 3d5905a8b2 Fix compiler build for non-ascii cabal path
CMake Visual Studio generator translates add_custom_command into a batch
file embedded in Visual Studio project. Batch files have problems with
paths that contain non-ascii characters because they are limited to DOS
encoding. It so happens that cabal is quite likely to be installed in
such a path because by default cabal installs into a directory under
%APPDATA% which contains user name. As a workaround we execute cmake
scripts as a custom commands and depend on CMake cache to get access to
variables set during configuration. This way embedded batch files are
free of non-ascii characters.
2015-01-12 17:45:57 -08:00
Dan Miller 013bf9b29b Fixing CMake permissions for OSX 2015-01-12 16:43:56 -08:00
Adam Sapek 222e20fd00 Initial commit 2015-01-09 11:21:05 -08:00