Espresso: Espresso and c++
Espresso - A web-framework that is compatible to C++14 and above.
This Tutorial will guide you to implement C++ code in Espresso. As Espresso is wrapper of C++ and so C++ headers can be include for that need to install latest version of GNU-GCC-7.5 or above.
Espresso+ compiler which combines espresso code and C++ and converts to executable code. In Espresso+ doesn't have C++ compiler, if there is no GNU compiler
it is not possible to execute Espresso code anyways because Espresso framework is built on the top of C++14 and C++17 and so need to upgrade your C++ compiler to latest version.
So Espresso framework could possible to embed C++ code also. The structure of semantics are very concise and readable that makes it's beauty.
Distributed to apt repository from where can be installed on Linux system.
Check Gcc version already install, must have gcc-7.5 or above. Follow the link: Get Started
Include
The preprocessor is executed at translation phase 4, before the compilation.
The result of preprocessing is a single file which is then passed to the actual compiler.
C++ headers can be implemented in espresso file for that need to use macro
__cplusplus,
inside the macro c++ code can be written.
include ( c++ header )
#include<iostream>
Import
import is executed at run-time, takes espresso filename and creates object:
typeof
Import
import ( Standard or User-defined )
auto espresso = import("espresso");
Bind: with . operator
and return http protocol object
auto espresso =
import("espresso").("http");
Operator: calls Operator ()
and return main application object which is binded to http protocol
auto app = espresso();
Typeof: Return (String)
and return main application object which is binded to http protocol
console.log(typeof(app));
Macro
The macros are flags, the codes inside the curly braces are not executed with Espresso+ compiler. The macros are itself help to differentiate espresso code and c++ code
Espresso+ removes the __cplusplus macros and put as it is. Other than macros, espresso compiler does semantic-analysis, translation and execution. Minimum number of code is sugessted to put inside the
multi-statements macro, that code structure is very concise and make esperesso it's beauty.
Single-statement macro ( put c++ code after colon)
__cplusplus: const char* s = "hello __cplusplus macro";
Multi-statements macro ( Put multiple c++ codes in inside the curly-braces)
__cplusplus{
const char* s = "hello __cplusplus macro";
}
console.log(s);
Compile-time warnings:
function say() {
console.log(" hello");
}
function say() {
char* s = "hello";
return s;
}
Compile-time warnings: __no_return
__no_return function say() {
console.log(" hello");
}
APIs reference documentation, provides details information about all fuctions and objects of Espresso, this documentation expalins every APIs in more details, so to implement easily
C++ projects and all APIs are complete compatible with C++11/14/17.
Espresso is very fast web-framework hybrid of C++, the main objective is just to make it easy and simple for C++ developers. This framework is built on top of C++14 and above
NOTE: It's the first version: Espresso_v_1.0.0, so there may occur some exeptions-throw, error or you find any idea.
Kindly contact me: sir.ayaz47@gmail.com