Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Parser.hpp"
- void Parser::Initialize() {
- Diagnostics::Initialize(Tokenizer.Code);
- }
- void Parser::CreateSyntaxTree() {
- // representation of
- /*
- function example(value: readonly integer, flag: readonly boolean) {
- }
- function main() {
- }
- */
- program = Program(
- {
- GlobalFunction(
- "example", // name
- { // parameters
- Parameter(
- "value", // name
- true, // is readonly
- "integer" // typename
- ),
- Parameter(
- "flag", // name
- true, // is readonly
- "boolean" // typename
- )
- }, // end of parameter
- GlobalFunctionScope(
- false // have't implemented yet
- )
- ),
- GlobalFunction(
- "main", // name
- {}, // no parameters
- GlobalFunctionScope(
- false // haven't implemented yet
- )
- )
- }
- );
- }
- void Parser::Log() {
- // you don't have to understand this. This is for the sake of representing everything with indents and pretty looking
- std::vector<std::string> display = Diagnostics::Display(program);
- std::cout << "Program:" << std::endl;
- for (std::size_t index = 0; index < display.size(); index += 1) {
- std::cout << " " << display[index] << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement