1.3.3 Compiling
Generating C++ Files
C++ source code files can be generated from files referenced in a parser .spg project file by running the parser generator 'spg':
C:\minilang>spg -v minilang.spg
> C:/minilang/minilang.spg
generating parsers for project 'minilang.spg'...
> C:/minilang/type_parser.parser
linking...
> C:/minilang/type_parser.parser
generating code...
==> C:/minilang/type_parser.cppm
==> C:/minilang/type_parser.cpp
generating rule name module...
==> C:/minilang/minilang_rules.cppm
==> C:/minilang/minilang_rules.cpp
parsers for project 'minilang.spg' generated successfully.
Adding the Generated Files
To add the generated files to the project:
-
Right-click your project in the Solution Explorer and select 'Add | Existing Item...'
-
Add the following files to the project:
- type_parser.cppm contains a module interface unit of a parser module
- type_parser.cpp contains a module implementation unit of a parser module
- minilang_rules.cppm contains a module interface unit of a rule name module
- minilang_rules.cpp contains a module implementation unit of a rule name module
Adding Support for Soul
At the moment probably the easiest way to add support for Soul is to add the required Soul library projects to the solution and then add references to the required Soul libraries.
-
Right-click the solution in the Solution Explorer and select 'Add | Existing Project...',
navigate to the C:\soul-4.0.0\soul\ast folder and add the ast.vcxproj to the solution.
-
Do the same for C:\soul-4.0.0\soul\lexer, C:\soul-4.0.0\soul\parser and C:\soul-4.0.0\util
projects.
- Expand your project in the Solution Explorer, right-click 'References' and select 'Add Reference...'
- Add a reference to the ast, lexer, parser and util module.
Compiling the Solution
- Select the 64 | Debug configuration.
- Select the Build | Build Solution command.
- The required Soul libraries and then your project should compile successfully.
- Select the 64 | Release configuration
- Select the Build | Build Solution command.
- The required Soul libraries and then your project should compile successfully.