Skip to content

Hello World

Sjoerd Vermeulen edited this page Apr 7, 2022 · 2 revisions

2 – Hello World

This is the traditional "Hello World!" program implemented in Evi:

hello_world

Let's break this down line by line.
The file starts with a preprocessor directive: #apply "std/io". This lets the compiler know that we'll be using the input/output header from the standard library, which includes functions like puts. (More on including files can be found in §6.1).
Then comes the declaration/definition of the main function. This function must be defined in each project and is the entry point of the program. (More on that here).
Immediatly after that comes the body of the function. In this case it consists of only one statement, so curly braces aren't necessary.
The statement is a call of the puts function. This simply calls the function from the "std/io" header that prints a string. Since there's no return statement, the integer value 0 is then implicitly returned.
That's everything that makes up a "Hello World!" program in Evi. You can test it (and validate your Evi installation) by compiling and running it using the following commands:

user@host:/some/directory $ evi hello_world.evi # your file
user@host:/some/directory $ ./hello_world
Hello World!
user@host:/some/directory $ _

on Linux, or

C:\Some\Directory> evi hello_world.evi # your file
C:\Some\Directory> ./hello_world.exe
Hello World!
C:\Some\Directory> _

on Windows (not yet officially supported).

The Hello World example and others can be found in the test/ directory of the Evi github repository.



Next: 3 – Basic Concepts

Contents

Home

1 – Introduction

2 – Hello World

3 – Basic Concepts

  3.1 – Types And Values

  3.2 – Type Modifiers

  3.3 – Arrays And Pointers

4 – The Language

  4.1 – Lexical Conventions

  4.2 – Variables And Parameters

  4.3 – Statements

    4.3.1 – Blocks

    4.3.2 – Assignment

    4.3.3 – Control Flow

    4.3.4 – Loops

    4.3.5 – Variable Declarations

  4.4 – Expressions

    4.4.1 – Arithmetic Operators

    4.4.2 – Bitwise Operators

    4.4.3 – Relational Operators

    4.4.5 – Logical Operators

    4.4.6 – The SizeOf Operator

    4.4.7 – The Casting Operator

    4.4.8 – Function Calls

    4.4.9 – Precedence

  4.5 – Visibility Rules

5 – The Standard Library

  5.1 – The Std Library

    5.1.1 – Input And Output

    5.1.2 – Mathematics

    5.1.3 – Memory Management

6 – The Preprocessor

  6.1 – Including Files

  6.2 – Setting Flags

  6.3 – Conditional Directives

  6.4 – Macros

  6.5 – Pragma Directives

  6.6 – Miscellaneous Directives

7 – The Compiler

  7.1 – Installation

  7.2 – Compilation

  7.3 – Execution

8 – The Complete Syntax

9 – Miscellaneous Information

  9.1 – Coding Conventions

    9.1.1 – Naming Conventions

    9.1.2 – Commenting Conventions

    9.1.3 – Miscellaneous Conventions

  9.2 – Credits

  9.3 – License

Clone this wiki locally