Skip to content

Commit 455829f

Browse files
[Update] Alpha-v.1.0.0
- Refactored the code base. - Fixed bugs.
1 parent 8034549 commit 455829f

40 files changed

Lines changed: 2723 additions & 1259 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
/.vscode
3-
noviq
3+
noviq
4+
noviq.exe

CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(Noviq VERSION 2.3.0 LANGUAGES C)
3+
4+
set(CMAKE_C_STANDARD 99)
5+
set(CMAKE_C_STANDARD_REQUIRED ON)
6+
7+
# Compiler warnings
8+
if(MSVC)
9+
add_compile_options(/W4 /WX-)
10+
else()
11+
add_compile_options(-Wall -Wextra -Wpedantic)
12+
endif()
13+
14+
# Include directories
15+
include_directories(${CMAKE_SOURCE_DIR}/include)
16+
17+
# Source files
18+
set(SOURCES
19+
src/main.c
20+
src/interpreter/interpreter.c
21+
src/interpreter/variables.c
22+
src/interpreter/expressions.c
23+
src/operators/arithmetic.c
24+
src/operators/logical.c
25+
src/operators/comparison.c
26+
src/statements/display.c
27+
src/statements/input.c
28+
src/statements/control_flow.c
29+
src/utils/error.c
30+
)
31+
32+
# Create executable
33+
add_executable(noviq ${SOURCES})
34+
35+
# Link math library (required for pow() function)
36+
if(UNIX)
37+
target_link_libraries(noviq PRIVATE m)
38+
endif()
39+
40+
# Installation
41+
install(TARGETS noviq DESTINATION bin)
42+
43+
# Print build information
44+
message(STATUS "Noviq Interpreter v${PROJECT_VERSION}")
45+
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
46+
message(STATUS "C Compiler: ${CMAKE_C_COMPILER}")

Makefile

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
1-
all:
2-
gcc -o noviq noviq.c lexer/lexer_interpret.c lexer/lexer_display.c -lm
1+
# Noviq Interpreter Makefile
2+
3+
CC = gcc
4+
CFLAGS = -Wall -Wextra -Wpedantic -std=c99 -Iinclude
5+
LDFLAGS = -lm
6+
TARGET = noviq
7+
SRCDIR = src
8+
OBJDIR = obj
9+
10+
# Source files
11+
SOURCES = $(SRCDIR)/main.c \
12+
$(SRCDIR)/interpreter/interpreter.c \
13+
$(SRCDIR)/interpreter/variables.c \
14+
$(SRCDIR)/interpreter/expressions.c \
15+
$(SRCDIR)/operators/arithmetic.c \
16+
$(SRCDIR)/operators/logical.c \
17+
$(SRCDIR)/operators/comparison.c \
18+
$(SRCDIR)/statements/display.c \
19+
$(SRCDIR)/statements/input.c \
20+
$(SRCDIR)/statements/control_flow.c \
21+
$(SRCDIR)/utils/error.c
22+
23+
# Object files
24+
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
25+
26+
# Create object directory structure
27+
$(shell mkdir -p $(OBJDIR)/interpreter $(OBJDIR)/operators $(OBJDIR)/statements $(OBJDIR)/utils)
28+
29+
all: $(TARGET)
30+
31+
$(TARGET): $(OBJECTS)
32+
$(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
33+
@echo "Build complete: $(TARGET)"
34+
35+
$(OBJDIR)/%.o: $(SRCDIR)/%.c
36+
@mkdir -p $(dir $@)
37+
$(CC) $(CFLAGS) -c $< -o $@
338

439
clean:
5-
rm -f noviq
40+
rm -rf $(OBJDIR) $(TARGET) $(TARGET).exe
41+
@echo "Clean complete"
42+
43+
rebuild: clean all
44+
45+
.PHONY: all clean rebuild

README.md

Lines changed: 208 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,223 @@
1-
```diff
2-
@@ The language is currently in PreAlpha development stages. @@
3-
@@ A lot of missing features and bugs are to be expected. @@
4-
```
1+
```diff```diff
2+
3+
@@ The language is currently in PreAlpha development stages. @@@@ The language is currently in PreAlpha development stages. @@
4+
5+
@@ A lot of missing features and bugs are to be expected. @@@@ A lot of missing features and bugs are to be expected. @@
6+
7+
``````
8+
59
# Noviq
6-
- The name Noviq is make up of two words: Nova(which means new) and unique.
10+
11+
# Noviq- The name Noviq is make up of two words: Nova(which means new) and unique.
12+
713
- So, Nova + unique = Noviq.
8-
- Noviq is just a simple interpreter based programming language written in C.
914
10-
## Wiki
15+
**Noviq** = **Nova** (new) + **unique**- Noviq is just a simple interpreter based programming language written in C.
16+
17+
18+
19+
A simple, interpreted programming language written in C with a focus on clarity and ease of use.## Wiki
20+
1121
[Click Here To Go To The Wiki](https://coredex-source.github.io/Noviq-site/wiki/introduction.html)
1222
23+
## Features
24+
1325
## Building and using
14-
### Requirements:
15-
- GCC (Only GCC on windows.)
16-
- make
17-
### Build using:
18-
- MacOS/Linux
26+
27+
✅ **Dynamic Typing** - Integers, floats, strings, and booleans ### Requirements:
28+
29+
✅ **Arithmetic Operations** - `+`, `-`, `*`, `/`, `%`, `**` (power), `//` (integer division) - GCC (Only GCC on windows.)
30+
31+
✅ **Logical Operations** - `AND`, `OR`, `NOT` (also `&&`, `||`, `!`) - make
32+
33+
✅ **Comparison Operators** - `>`, `<`, `>=`, `<=`, `==` ### Build using:
34+
35+
✅ **Control Flow** - `if`/`else` statements with nesting support - MacOS/Linux
36+
37+
✅ **Constants** - Immutable values with `const` keyword ```
38+
39+
✅ **User Input** - Interactive programs with `input()` make all
40+
41+
✅ **String Formatting** - Variable substitution with `%var1`, `%var2`, etc.```
42+
43+
- Windows
44+
45+
## Documentation```
46+
47+
gcc -o noviq.exe noviq.c lexer/lexer_interpret.c lexer/lexer_display.c -lm
48+
49+
📚 [Language Wiki](https://coredex-source.github.io/Noviq-site/wiki/introduction.html) ```
50+
51+
📖 [Language Reference](docs/language_reference.md)### Run using:
52+
53+
- MacOS/Linux:
54+
55+
## Project Structure```
56+
57+
./noviq -e filename.nvq
58+
59+
``````
60+
61+
Noviq/- Windows (cmd):
62+
63+
├── src/```
64+
65+
│ ├── main.c # Entry pointnoviq.exe -e filename.nvq
66+
67+
│ ├── interpreter/ # Core interpreter```
68+
69+
│ │ ├── interpreter.c # Command interpretation
70+
│ │ ├── variables.c # Variable management
71+
│ │ └── expressions.c # Expression evaluation
72+
│ ├── operators/ # Operator implementations
73+
│ │ ├── arithmetic.c # Arithmetic operations
74+
│ │ ├── logical.c # Logical operations
75+
│ │ └── comparison.c # Comparison operations
76+
│ ├── statements/ # Statement handlers
77+
│ │ ├── display.c # Output functionality
78+
│ │ ├── input.c # Input handling
79+
│ │ └── control_flow.c # If/else statements
80+
│ └── utils/
81+
│ └── error.c # Error reporting
82+
├── include/ # Header files
83+
├── examples/ # Example programs
84+
├── tests/ # Test files
85+
├── docs/ # Documentation
86+
├── CMakeLists.txt # CMake build configuration
87+
├── Makefile # Make build configuration
88+
└── README.md
1989
```
90+
91+
## Quick Start
92+
93+
### Requirements
94+
95+
- **GCC** or compatible C compiler
96+
- **Make** (optional, for Makefile build)
97+
- **CMake** 3.10+ (optional, for CMake build)
98+
99+
### Build Options
100+
101+
#### Option 1: Using Make (Recommended for Unix-like systems)
102+
103+
```bash
20104
make all
21105
```
22-
- Windows
106+
107+
#### Option 2: Using CMake (Cross-platform)
108+
109+
```bash
110+
mkdir build
111+
cd build
112+
cmake ..
113+
cmake --build .
23114
```
24-
gcc -o noviq.exe noviq.c lexer/lexer_interpret.c lexer/lexer_display.c -lm
115+
116+
#### Option 3: Direct compilation (Windows)
117+
118+
```cmd
119+
gcc -o noviq.exe -Iinclude src\main.c src\interpreter\*.c src\operators\*.c src\statements\*.c src\utils\*.c -lm
25120
```
26-
### Run using:
27-
- MacOS/Linux:
121+
122+
### Run
123+
124+
```bash
125+
# Unix/Linux/macOS
126+
./noviq -e examples/hello_world.nvq
127+
128+
# Windows
129+
noviq.exe -e examples\hello_world.nvq
28130
```
29-
./noviq -e filename.nvq
131+
132+
### Command-Line Options
133+
134+
```
135+
noviq [options]
136+
137+
Options:
138+
-e <filename> Execute a Noviq script file (.nvq)
139+
--help Display help message
140+
--version Display version information
141+
```
142+
143+
## Examples
144+
145+
### Hello World
146+
147+
```noviq
148+
display("Hello, World!")
149+
```
150+
151+
### Variables and Arithmetic
152+
153+
```noviq
154+
x = 10
155+
y = 5
156+
result = x + y
157+
display("Result: %var1", result)
158+
```
159+
160+
### Control Flow
161+
162+
```noviq
163+
age = 20
164+
if(age >= 18){
165+
display("You are an adult")
166+
} else {
167+
display("You are a minor")
168+
}
30169
```
31-
- Windows (cmd):
170+
171+
### Constants
172+
173+
```noviq
174+
const PI = 3.14159
175+
radius = 5
176+
area = PI * radius * radius
177+
display("Area: %var1", area)
178+
```
179+
180+
More examples available in the `examples/` directory.
181+
182+
## Development
183+
184+
### Building from Source
185+
186+
1. Clone the repository
187+
```bash
188+
git clone https://github.com/coredex-source/Noviq.git
189+
cd Noviq
190+
```
191+
192+
2. Build using your preferred method
193+
```bash
194+
make all
32195
```
33-
noviq.exe -e filename.nvq
196+
197+
3. Test the build
198+
```bash
199+
./noviq -e examples/hello_world.nvq
34200
```
201+
202+
### Clean Build
203+
204+
```bash
205+
make clean
206+
make all
207+
```
208+
209+
## Contributing
210+
211+
Contributions are welcome! Please feel free to submit issues or pull requests.
212+
213+
## License
214+
215+
GPL-3.0 - See [LICENSE](LICENSE) for details.
216+
217+
## Version
218+
219+
Current version: **prealpha-v2.3.0**
220+
221+
---
222+
223+
*Note: This project is in pre-alpha development. Features may change, and bugs are expected.*

build.bat

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@echo off
2+
REM Build script for Noviq on Windows
3+
REM Requires GCC (MinGW or similar) to be installed and in PATH
4+
5+
echo Building Noviq...
6+
7+
gcc -o noviq.exe -Iinclude ^
8+
src\main.c ^
9+
src\interpreter\interpreter.c ^
10+
src\interpreter\variables.c ^
11+
src\interpreter\expressions.c ^
12+
src\operators\arithmetic.c ^
13+
src\operators\logical.c ^
14+
src\operators\comparison.c ^
15+
src\statements\display.c ^
16+
src\statements\input.c ^
17+
src\statements\control_flow.c ^
18+
src\utils\error.c ^
19+
-lm
20+
21+
if %ERRORLEVEL% EQU 0 (
22+
echo.
23+
echo Build successful! Executable: noviq.exe
24+
echo.
25+
echo Usage:
26+
echo noviq.exe -e ^<file^> Execute a Noviq script
27+
echo noviq.exe -h Show help
28+
echo.
29+
) else (
30+
echo.
31+
echo Build failed with error code %ERRORLEVEL%
32+
exit /b %ERRORLEVEL%
33+
)

0 commit comments

Comments
 (0)