Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hisoka999/wirthx
Wirthx is a pascal compiler and interpreter
https://github.com/hisoka999/wirthx
compiler llvm pascal
Last synced: 2 months ago
JSON representation
Wirthx is a pascal compiler and interpreter
- Host: GitHub
- URL: https://github.com/hisoka999/wirthx
- Owner: hisoka999
- License: bsd-3-clause
- Created: 2024-04-20T15:44:10.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-29T17:28:03.000Z (3 months ago)
- Last Synced: 2024-11-29T18:27:25.435Z (3 months ago)
- Topics: compiler, llvm, pascal
- Language: C++
- Homepage:
- Size: 255 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wirthx
Wirthx is an experimental pascal compiler.
The language is named after Nicolaus Wirth the creator of pascal.## Compiler
The compiler is based on llvm and will generate a native binary for the target plattform.
For now only `linux-x86-64` is supported.# Usage
```sh
wirthx testfiles/hello.pas
```
## Executing the compiler
The compiler will generate a native executable based on the program name defined in the program unit.```sh
wirthx -c testfiles/hello.pas
```# Examples
## Hello World
```pascal
program testbegin
Writeln('Hello World');
end.
```
## Functions```pascal
program testfunction addx(a : integer;b :integer): integer;
begin
addx := a + b;
end;
var
my_var : integer;
begin
my_var := addx(1,2);
Writeln(my_var);
end.
```## Records
```pascal
program testtype Vec2 = record
x : int64;
y : int64;
end;// pass the vector as a reference
procedure vec2_inc(var t : Vec2);
begin
t.x := t.x + 1;
t.y := t.y + 1;
end;
var
myvec : Vec2;
begin
myvec.x := 2;
myvec.y := 3;
vec2_inc(myvec);
end.```