- EbNoL
EbNoL revolves around the use of modules. The four main types of modules are the Main, Secondary, Definition, and Task.
Main Module: The Main Module is necessary for every program, and there is only one per program. Within the main module, the Main function defines the entry point for the program. The Main Module is flexible, but it is typically used for performing initialization and management related tasks. The purposeful code is typically reserved for the secondary modules.
Secondary Modules: The secondary modules are designed to hold the purposeful code. Secondary modules are typically used to organize additional code. There are no special identifiers to indicate a secondary module.
Definition Modules: The Definition modules are used to define new data types and relevant conversion functions. For example: if using the metric system then meters, km, and so on can be defined in the definition module. In the same example, functions for converting from meters to km or meters to unsigned 64 bit ints can be defined.
Task Modules: The task modules are used to define new tasks (threads). Based on the target parameters given to the compiler tasks will be compiled for the correct target: linux, VxWorks, FreeRTOS, or RTEMS. Tasks will require scheduling options and need to have other aspects defined, but this will be covered in a later lesson.
The secondary module is the only module that does not require a specific definition. Main modules must have the keyword main, definition modules must be specified as a definition module, and task modules must be specified as a task module.
Each module must also be closed by typing END [module name]
. Code blocks in EbNoL are not defined with brackets but instead are defined by opening and closeing statements.
// Create the main module for the program
Mod Main
func Main(int argc, char array(0,0) argv) void
// Entry point for the program
END Main
END Main
// Create a secondary module for the program
Mod helloWorldCode
func helloworld() void
// function within the secondary module
END helloworld
END helloWorldCode
// Create a definition module for the program
Mod def lets_define_stuff
// Define Meters
def i32 meters_t
// Define KM
def i32 km_t
// Convert from meters to km
func to_km_t(meters_t input) i32
i32 output
`output = input`
return output
end to_km_t
END lets_define_stuff
// Create a task module for the program
Mod task myNewTask
// Task specifics go here
END myNewTask
Modules are not specific to a file. You can create multiple modules per file. Additional modules are referenced normally.
// Create the main module for the program
Mod Main
func Main(int argc, char array(0,0) argv) void
// Call the secondary module
helloworld()
END Main
END Main
// Create a secondary module
Mod MySecondaryModule
func helloworld() void
END helloworld
END MySecondaryModule
Modules can be split up between different files and there is no need import the other module. As long as the other modules directory is given to the transpiler, then EbNoL will automatically make that link.
// Create the main module for the program
Mod Main
func Main(int argc, char array(0,0) argv) void
// Entry point for the program
helloworld()
END Main
END Main
// Create a secondary module
Mod MySecondaryModule
func helloworld() void
END helloworld
END MySecondaryModule