100 lines
2.7 KiB
Markdown
100 lines
2.7 KiB
Markdown
# Jeene
|
|
|
|
Jeene is a compiled programming language designed for extensibility through macros and featuring a powerful type system.
|
|
|
|
## Features
|
|
|
|
### Current Features
|
|
|
|
- Pratt parser with operator precedence
|
|
- Support for arithmetic expressions, arrays, function calls, member access, and assignments
|
|
- Extensible grammar system
|
|
- Proper error reporting with line/column information
|
|
- Advanced type system with support for:
|
|
- Interfaces and custom types
|
|
- Union and intersection types
|
|
- Callable types
|
|
- Reference types
|
|
- Variance and uniqueness constraints
|
|
- Abstract types (containers, named types, shapes)
|
|
|
|
### Planned Features
|
|
|
|
- Full compiler implementation
|
|
- Semantic analysis
|
|
- Macro system for language extensibility
|
|
- Extension/plugin architecture
|
|
- Enhanced parsing for control structures, classes, and modules
|
|
- Type inference and checking
|
|
- Code generation to multiple targets (JavaScript, WebAssembly, etc.)
|
|
- Runtime environment with garbage collection
|
|
- Standard library with common utilities
|
|
|
|
## Usage
|
|
|
|
```typescript
|
|
import { Grammar, Parser, Tokenizer } from './src/compiler';
|
|
|
|
const grammar = Grammar.createDefault();
|
|
const tokenizer = new Tokenizer(grammar);
|
|
const parser = new Parser(tokenizer, grammar);
|
|
|
|
const ast = parser.parse('1 + 2 * 3');
|
|
console.log(ast);
|
|
```
|
|
|
|
## Supported Syntax
|
|
|
|
- Literals: numbers, strings, identifiers
|
|
- Arithmetic: `+`, `-`, `*`, `/`
|
|
- Arrays: `[1, 2, 3]`
|
|
- Function calls: `func(1, 2)`
|
|
- Member access: `a.b.c`
|
|
- Assignment: `x = 42`
|
|
- Grouping: `(1 + 2)`
|
|
- Object literals: `{ key: value }`
|
|
- Variable declarations with types: `const name: str = 'value'`
|
|
- Object instantiation: `new ClassName(args)`
|
|
|
|
## Installation
|
|
|
|
To install dependencies:
|
|
|
|
```bash
|
|
bun install
|
|
```
|
|
|
|
## Development
|
|
|
|
To run the parser on the example file:
|
|
|
|
```bash
|
|
bun run test/example.ts
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
- `src/compiler/`: Core compiler components (AST, parser, tokenizer, grammar)
|
|
- `src/core/`: Type system implementation
|
|
- `src/grammars/`: Grammar definitions
|
|
- `test/`: Example files and test scripts
|
|
|
|
## Roadmap
|
|
|
|
- [ ] Complete the compiler pipeline (lexer → parser → type checker → code generator)
|
|
- [ ] Implement macro system for compile-time metaprogramming
|
|
- [ ] Build extension/plugin system for language customization
|
|
- [ ] Add support for advanced language constructs (classes, modules, generics)
|
|
- [ ] Develop a standard library
|
|
- [ ] Create a runtime environment
|
|
- [ ] Add tooling (debugger, profiler, package manager)
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
|
|
## License
|
|
|
|
This project is licensed under the UNLICENSE license.
|
|
|
|
This project was created using `bun init` in bun v1.3.5. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
|