Skip to content

Commit

Permalink
Merge pull request #39 from zestones/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
zestones authored Feb 10, 2025
2 parents 4d82f14 + e05bf2d commit 0c11fab
Show file tree
Hide file tree
Showing 82 changed files with 586 additions and 277 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# defines the compiler and flags #
# ------------------------------------------------------ #
CC = gcc
CFLAGS = -g
CFLAGS = -g -Wall -Wextra -pedantic
LEX = lex
YACC = yacc

Expand Down Expand Up @@ -49,6 +49,7 @@ all: compiler vm simple-clean
install:
sudo apt install flex bison
sudo apt install doxygen
sudo apt install gdb

extension-install:
@if [ -d ~/.vscode/extensions/ ]; then \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
Format string expects 2 arguments, but 1 were provided.
Ensure the correct number of arguments are passed to match the format string.

[Semantic Error] Argument mismatch in format string at example/compilation/errors/semantic/func_proc/predefined/input_proc.arn:25:16.
Format string expects 2 arguments, but 0 were provided.
Ensure the correct number of arguments are passed to match the format string.

Verbose mode enabled. Printing tables and ast...

+----------------------------+
Expand Down Expand Up @@ -168,5 +172,7 @@ Root of the AST:
│ │ │ │ ├── A_ARGUMENT, Lexico Idx: -1, Decl Idx: -1
│ │ │ │ │ ├── A_IDENTIFIER, Lexico Idx: 5, Decl Idx: 5 -- Lexeme: 'name'
│ │ │ └── A_FORMAT_STRING, Lexico Idx: 17, Decl Idx: -1 -- Lexeme: '"%c %d"'
│ │ └── A_INPUT_STATEMENT, Lexico Idx: -1, Decl Idx: -1
│ │ │ ├── A_FORMAT_STRING, Lexico Idx: 17, Decl Idx: -1 -- Lexeme: '"%c %d"'
+------------------------------------------------------------------------+

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
Argument '2' has type '"Hello %d"', but specifier 'f' expects a different type.
Ensure the argument type matches the expected type for the specifier.

[Semantic Error] Argument mismatch in format string at example/compilation/errors/semantic/func_proc/predefined/print_proc.arn:10:31.
Format string expects 2 arguments, but 0 were provided.
Ensure the correct number of arguments are passed to match the format string.

Verbose mode enabled. Printing tables and ast...

+----------------------------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
The type 'date' should be a base type (int, float, bool, char).
Ensure the type is one of the supported base types.

[Type Error] Invalid type 'date' at example/compilation/errors/semantic/type/base_type.arn:16:26.
The type 'date' should be a base type (int, float, bool, char).
Ensure the type is one of the supported base types.

Verbose mode enabled. Printing tables and ast...

+----------------------------+
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/lexical/unknow_char.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var a : float;
var f : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/array/access.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/array/assignement.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/array/undefined.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : int;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : int;
var is_red : bool;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG

// Assuming the following types are defined as:
type date : struct {
jour : int;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : int;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var a : int;
var b : float;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x:bool;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x:bool;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : int;
var name : char;
Expand All @@ -22,3 +22,4 @@ input("%d %c", my_struct.jour, name);
input("%d %c", my_struct.annee, name);
input("%d", my_struct.mois, name);
input("%c %d", name);
input("%c %d");
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


print("Hello %d", 42);
print("Hello %d, here is %s", 42, "world");
Expand All @@ -7,3 +7,4 @@ print("Hello %d, here is %s", 42, "world");
print("Hello %d", 42, "extra"); // Error: Too many arguments
print("Hello %d, here is %s", 42); // Error: Too few arguments
print("Hello %d, here is %f", 42, "oops"); // Error: Type mismatch
print("Hello %d, here is %s"); // Error: Missing arguments
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


func zero() -> float {
return 0.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


func main() -> int {
return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : int;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type x : struct {
a : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/struct/access.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/struct/assignement.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/struct/undefined.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/type/base_type.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/type/redefined.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/type/undefined.arn
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PROG

var x : int;
var z : x; // x is a variable not a type so undefined type x
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type date : struct {
jour : int;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/variable/redefined.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x: int;
var x: int;
2 changes: 1 addition & 1 deletion example/compilation/errors/semantic/variable/undefined.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var n : int;

Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/syntax/mixed_declaration.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var n : int;
n := 5;
Expand Down
2 changes: 1 addition & 1 deletion example/compilation/errors/syntax/reserved_token.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var x : char;

Expand Down
2 changes: 1 addition & 1 deletion example/compilation/to-remove.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type matrix: array[0:9, 0:9] of int;

Expand Down
2 changes: 1 addition & 1 deletion example/interpretation/array.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


type tab : array[0:1, 0:1, 0:1] of int;
var tab : tab;
Expand Down
2 changes: 1 addition & 1 deletion example/interpretation/break.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


var n : int;

Expand Down
2 changes: 1 addition & 1 deletion example/interpretation/calculator/simple-calculator.arn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG


// Calculator Program with Enhanced ASCII Display
var choice: int;
Expand Down
Loading

0 comments on commit 0c11fab

Please sign in to comment.