Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
ContenT
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ContenT
Commits
ec4a018f
Commit
ec4a018f
authored
Feb 16, 2026
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compile-time method validation
parent
2aab914d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
9 deletions
+49
-9
LANGUAGE_SPEC.md
LANGUAGE_SPEC.md
+29
-1
README.md
README.md
+1
-0
README_ru.md
README_ru.md
+1
-0
dispatch_codegen.py
bootstrap/dispatch_codegen.py
+0
-0
errors.py
bootstrap/errors.py
+18
-8
No files found.
LANGUAGE_SPEC.md
View file @
ec4a018f
...
...
@@ -907,7 +907,35 @@ Error: Missing closing brace
--> main.ct:15:1
```
Показывает все ошибки сразу.
### Проверка методов
Компилятор проверяет существование методов при компиляции:
```
Error: Unknown method 'nonexistent' for type 'array'. Available: filter, get, join, len, map, pop, push, set, shift, slice
--> main.ct:5:1
Error: Unknown method 'badMethod' for type 'fs'. Available: append, exists, list, mkdir, open, read, remove, write
--> main.ct:10:8
```
Проверяются методы для:
-
**Массивов**
—
`filter`
,
`get`
,
`join`
,
`len`
,
`map`
,
`pop`
,
`push`
,
`set`
,
`shift`
,
`slice`
-
**Словарей**
—
`del`
,
`get`
,
`has`
,
`keys`
,
`set`
-
**Строк**
—
`charAt`
,
`contains`
,
`ends`
,
`index`
,
`len`
,
`lower`
,
`replace`
,
`split`
,
`starts`
,
`substr`
,
`trim`
,
`upper`
-
**Файловых дескрипторов**
—
`close`
,
`read`
,
`readline`
,
`write`
,
`writeln`
-
**Stdlib namespaces**
:
-
`fs`
—
`append`
,
`exists`
,
`list`
,
`mkdir`
,
`open`
,
`read`
,
`remove`
,
`write`
-
`http`
—
`delete`
,
`get`
,
`post`
,
`put`
-
`json`
—
`parse`
,
`stringify`
-
`logger`
—
`debug`
,
`error`
,
`info`
,
`warn`
-
`regex`
—
`extract`
,
`match`
-
`args`
—
`count`
,
`get`
-
`shell`
—
`capture`
,
`exec`
,
`source`
-
`time`
—
`ms`
,
`now`
-
`math`
—
`abs`
,
`add`
,
`div`
,
`max`
,
`min`
,
`mod`
,
`mul`
,
`sub`
Показывает все ошибки сразу (без дубликатов).
---
...
...
README.md
View file @
ec4a018f
...
...
@@ -17,6 +17,7 @@
-
**Error handling**
—
`try/except/finally/throw/defer`
-
**String interpolation**
—
`"Hello, {name}!"`
-
**@awk functions**
— compile to AWK for ~300x speedup on string/numeric operations
-
**Compile-time method validation**
— catches unknown methods before runtime
-
**Optimized output**
- no unnecessary subshells, inlined methods
## Installation
...
...
README_ru.md
View file @
ec4a018f
...
...
@@ -17,6 +17,7 @@
-
**Обработка ошибок**
—
`try/except/finally/throw/defer`
-
**Строковая интерполяция**
—
`"Привет, {name}!"`
-
**@awk функции**
— компиляция в AWK для ускорения ~300x на строковых/числовых операциях
-
**Проверка методов при компиляции**
— выявление несуществующих методов до запуска
-
**Оптимизированный вывод**
— без лишних subshell, инлайнинг методов
## Установка
...
...
bootstrap/dispatch_codegen.py
View file @
ec4a018f
This diff is collapsed.
Click to expand it.
bootstrap/errors.py
View file @
ec4a018f
...
...
@@ -20,18 +20,28 @@ class CompileError:
class
ErrorCollector
:
def
__init__
(
self
):
self
.
errors
:
List
[
CompileError
]
=
[]
self
.
_seen
:
set
=
set
()
def
_error_key
(
self
,
msg
:
str
,
filename
:
str
,
line
:
int
,
column
:
int
)
->
tuple
:
return
(
msg
,
filename
,
line
,
column
)
def
add
(
self
,
error
:
CompileError
):
self
.
errors
.
append
(
error
)
key
=
self
.
_error_key
(
error
.
message
,
error
.
filename
,
error
.
line
,
error
.
column
)
if
key
not
in
self
.
_seen
:
self
.
_seen
.
add
(
key
)
self
.
errors
.
append
(
error
)
def
add_error
(
self
,
message
:
str
,
filename
:
str
,
line
:
int
,
column
:
int
,
hint
:
str
=
None
):
self
.
errors
.
append
(
CompileError
(
message
=
message
,
filename
=
filename
,
line
=
line
,
column
=
column
,
hint
=
hint
))
key
=
self
.
_error_key
(
message
,
filename
,
line
,
column
)
if
key
not
in
self
.
_seen
:
self
.
_seen
.
add
(
key
)
self
.
errors
.
append
(
CompileError
(
message
=
message
,
filename
=
filename
,
line
=
line
,
column
=
column
,
hint
=
hint
))
def
has_errors
(
self
)
->
bool
:
return
len
(
self
.
errors
)
>
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment