mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Fixes (Doc typos, pragma once worng type, non-debug fatal compile fail)
This commit is contained in:
parent
b5fa864318
commit
5aff89262b
@ -30,7 +30,7 @@ CodeVar parse_variable ( StrC var_def );
|
|||||||
***Parsing will aggregate any tokens within a function body or expression statement to an untyped Code AST.***
|
***Parsing will aggregate any tokens within a function body or expression statement to an untyped Code AST.***
|
||||||
|
|
||||||
Everything is done in one pass for both the preprocessor directives and the rest of the language.
|
Everything is done in one pass for both the preprocessor directives and the rest of the language.
|
||||||
The parser performs no macro expansion as the scope of gencpp feature-set is to only support the preprocessor for the goal of having rudimentary awareness of preprocessor ***conditionals***, ***defines***, and ***includes***, and ***pragmas**.
|
The parser performs no macro expansion as the scope of gencpp feature-set is to only support the preprocessor for the goal of having rudimentary awareness of preprocessor ***conditionals***, ***defines***, and ***includes***, and ***pragmas***.
|
||||||
|
|
||||||
The keywords supported for the preprocessor are:
|
The keywords supported for the preprocessor are:
|
||||||
|
|
||||||
@ -69,4 +69,4 @@ The lexing and parsing takes shortcuts from whats expected in the standard.
|
|||||||
* *Upfront constructors are not necessarily used in the parsing constructors, this is just a good metric to know what can be parsed.*
|
* *Upfront constructors are not necessarily used in the parsing constructors, this is just a good metric to know what can be parsed.*
|
||||||
* Parsing attributes can be extended to support user defined macros by defining `GEN_DEFINE_ATTRIBUTE_TOKENS` (see `gen.hpp` for the formatting)
|
* Parsing attributes can be extended to support user defined macros by defining `GEN_DEFINE_ATTRIBUTE_TOKENS` (see `gen.hpp` for the formatting)
|
||||||
|
|
||||||
Empty lines used throughout the file are preserved for formatting purposes for ast serialization.
|
Empty lines used throughout the file are preserved for formatting purposes during ast serialization.
|
||||||
|
@ -40,15 +40,6 @@ Otherwise the library is free of any templates.
|
|||||||
|
|
||||||
### *WHAT IS NOT PROVIDED*
|
### *WHAT IS NOT PROVIDED*
|
||||||
|
|
||||||
Keywords kept from "Modern C++":
|
|
||||||
|
|
||||||
* constexpr : Great to store compile-time constants.
|
|
||||||
* consteval : Technically fine, need to make sure to execute in moderation.
|
|
||||||
* constinit : Better than constexpr at doing its job, however, its only c++ 20.
|
|
||||||
* export : Useful if c++ modules ever come around to actually being usable.
|
|
||||||
* import : ^^
|
|
||||||
* module : ^^
|
|
||||||
|
|
||||||
**There is no support for validating expressions.**
|
**There is no support for validating expressions.**
|
||||||
Its difficult to parse without enough benefits (At the metaprogramming level).
|
Its difficult to parse without enough benefits (At the metaprogramming level).
|
||||||
|
|
||||||
@ -70,7 +61,7 @@ Use at your own mental peril.
|
|||||||
|
|
||||||
As mentioned in root readme, the user is provided Code objects by calling the constructor's functions to generate them or find existing matches.
|
As mentioned in root readme, the user is provided Code objects by calling the constructor's functions to generate them or find existing matches.
|
||||||
|
|
||||||
The AST is managed by the library and provided the user via its interface.
|
The AST is managed by the library and provided to the user via its interface.
|
||||||
However, the user may specifiy memory configuration.
|
However, the user may specifiy memory configuration.
|
||||||
|
|
||||||
Data layout of AST struct:
|
Data layout of AST struct:
|
||||||
|
@ -117,7 +117,7 @@ void define_constants()
|
|||||||
fmt_newline.set_global();
|
fmt_newline.set_global();
|
||||||
|
|
||||||
pragma_once = (CodePragma) make_code();
|
pragma_once = (CodePragma) make_code();
|
||||||
pragma_once->Type = ECode::Untyped;
|
pragma_once->Type = ECode::Preprocess_Pragma;
|
||||||
pragma_once->Name = get_cached_string( txt_StrC("once") );
|
pragma_once->Name = get_cached_string( txt_StrC("once") );
|
||||||
pragma_once->Content = pragma_once->Name;
|
pragma_once->Content = pragma_once->Name;
|
||||||
pragma_once.set_global();
|
pragma_once.set_global();
|
||||||
|
@ -49,7 +49,7 @@ void process_exit( u32 code );
|
|||||||
# define fatal( fmt, ... ) \
|
# define fatal( fmt, ... ) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
str_fmt_out_err_va( fmt, __VA_ARGS__ ); \
|
str_fmt_out_err( fmt, __VA_ARGS__ ); \
|
||||||
process_exit(1); \
|
process_exit(1); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
@ -42,26 +42,26 @@ int gen_main()
|
|||||||
Code timing = scan_file( "dependencies/timing.hpp" );
|
Code timing = scan_file( "dependencies/timing.hpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
deps_header = Builder::open("gen/gen.dep.hpp");
|
header = Builder::open("gen/gen.dep.hpp");
|
||||||
deps_header.print_fmt( generation_notice );
|
header.print_fmt( generation_notice );
|
||||||
deps_header.print_fmt( "// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)\n\n" );
|
header.print_fmt( "// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)\n\n" );
|
||||||
deps_header.print( header_start );
|
header.print( header_start );
|
||||||
deps_header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||||
|
|
||||||
deps_header.print( macros );
|
header.print( macros );
|
||||||
deps_header.print( basic_types );
|
header.print( basic_types );
|
||||||
deps_header.print( debug );
|
header.print( debug );
|
||||||
deps_header.print( memory );
|
header.print( memory );
|
||||||
deps_header.print( string_ops );
|
header.print( string_ops );
|
||||||
deps_header.print( printing );
|
header.print( printing );
|
||||||
deps_header.print( containers );
|
header.print( containers );
|
||||||
deps_header.print( hashing );
|
header.print( hashing );
|
||||||
deps_header.print( string );
|
header.print( string );
|
||||||
deps_header.print( file_handling );
|
header.print( file_handling );
|
||||||
deps_header.print( timing );
|
header.print( timing );
|
||||||
|
|
||||||
deps_header.print_fmt( "GEN_NS_END\n\n" );
|
header.print_fmt( "GEN_NS_END\n\n" );
|
||||||
deps_header.write();
|
header.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// gen_dep.cpp
|
// gen_dep.cpp
|
||||||
@ -77,23 +77,23 @@ int gen_main()
|
|||||||
Code timing = scan_file( "dependencies/timing.cpp" );
|
Code timing = scan_file( "dependencies/timing.cpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
deps_impl = Builder::open( "gen/gen.dep.cpp" );
|
src = Builder::open( "gen/gen.dep.cpp" );
|
||||||
deps_impl.print_fmt( generation_notice );
|
src.print_fmt( generation_notice );
|
||||||
deps_impl.print_fmt( "// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n" );
|
src.print_fmt( "// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n" );
|
||||||
deps_impl.print( src_start );
|
src.print( src_start );
|
||||||
deps_impl.print_fmt( "GEN_NS_BEGIN\n\n" );
|
src.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||||
|
|
||||||
deps_impl.print( debug );
|
src.print( debug );
|
||||||
deps_impl.print( string_ops );
|
src.print( string_ops );
|
||||||
deps_impl.print( printing );
|
src.print( printing );
|
||||||
deps_impl.print( hashing );
|
src.print( hashing );
|
||||||
deps_impl.print( memory );
|
src.print( memory );
|
||||||
deps_impl.print( string );
|
src.print( string );
|
||||||
deps_impl.print( file_handling );
|
src.print( file_handling );
|
||||||
deps_impl.print( timing );
|
src.print( timing );
|
||||||
|
|
||||||
deps_impl.print_fmt( "GEN_NS_END\n\n" );
|
src.print_fmt( "GEN_NS_END\n\n" );
|
||||||
deps_impl.write();
|
src.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// gen.hpp
|
// gen.hpp
|
||||||
|
@ -6,16 +6,12 @@
|
|||||||
GEN_NS_BEGIN
|
GEN_NS_BEGIN
|
||||||
|
|
||||||
#include "dependencies/debug.cpp"
|
#include "dependencies/debug.cpp"
|
||||||
|
|
||||||
#include "dependencies/string_ops.cpp"
|
#include "dependencies/string_ops.cpp"
|
||||||
#include "dependencies/printing.cpp"
|
#include "dependencies/printing.cpp"
|
||||||
#include "dependencies/memory.cpp"
|
#include "dependencies/memory.cpp"
|
||||||
|
|
||||||
#include "dependencies/hashing.cpp"
|
#include "dependencies/hashing.cpp"
|
||||||
#include "dependencies/string.cpp"
|
#include "dependencies/string.cpp"
|
||||||
|
#include "dependencies/file_handling.cpp"
|
||||||
#include "dependencies/timing.cpp"
|
#include "dependencies/timing.cpp"
|
||||||
|
|
||||||
#include "dependencies/file_handling.cpp"
|
|
||||||
|
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
@ -8,17 +8,13 @@ GEN_NS_BEGIN
|
|||||||
#include "dependencies/macros.hpp"
|
#include "dependencies/macros.hpp"
|
||||||
#include "dependencies/basic_types.hpp"
|
#include "dependencies/basic_types.hpp"
|
||||||
#include "dependencies/debug.hpp"
|
#include "dependencies/debug.hpp"
|
||||||
|
|
||||||
#include "dependencies/memory.hpp"
|
#include "dependencies/memory.hpp"
|
||||||
#include "dependencies/string_ops.hpp"
|
#include "dependencies/string_ops.hpp"
|
||||||
#include "dependencies/printing.hpp"
|
#include "dependencies/printing.hpp"
|
||||||
|
|
||||||
#include "dependencies/containers.hpp"
|
#include "dependencies/containers.hpp"
|
||||||
#include "dependencies/hashing.hpp"
|
#include "dependencies/hashing.hpp"
|
||||||
#include "dependencies/string.hpp"
|
#include "dependencies/string.hpp"
|
||||||
|
#include "dependencies/file_handling.hpp"
|
||||||
#include "dependencies/timing.hpp"
|
#include "dependencies/timing.hpp"
|
||||||
|
|
||||||
#include "dependencies/file_handling.hpp"
|
|
||||||
|
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
@ -20,7 +20,7 @@ void check_sanity()
|
|||||||
fatal("check_sanity: String caching failed!");
|
fatal("check_sanity: String caching failed!");
|
||||||
|
|
||||||
|
|
||||||
// Purposefully use an excessive amount of memory to make so the the memory backend doesn't break.
|
// Purposefully uses an excessive amount of memory to make sure the the memory backend doesn't break.
|
||||||
// This has been tested with num_iterations set to 15000000 (generates 15 million lines of code), the Global_BlockSize, along with CodePool_NumBlocks, and SizePer_StringArena
|
// This has been tested with num_iterations set to 15000000 (generates 15 million lines of code), the Global_BlockSize, along with CodePool_NumBlocks, and SizePer_StringArena
|
||||||
// must be adjusted to gigabytes(2), kilobytes(512), and gigabyte(1) for good performance without crashing.
|
// must be adjusted to gigabytes(2), kilobytes(512), and gigabyte(1) for good performance without crashing.
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user