https://github.com/znsoooo/lisp-parser
A Lisp parser based on Python's regular expression.
https://github.com/znsoooo/lisp-parser
Last synced: 5 months ago
JSON representation
A Lisp parser based on Python's regular expression.
- Host: GitHub
- URL: https://github.com/znsoooo/lisp-parser
- Owner: znsoooo
- Created: 2024-06-01T04:20:19.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-31T03:58:12.000Z (over 1 year ago)
- Last Synced: 2025-05-31T08:36:53.679Z (about 1 year ago)
- Language: Common Lisp
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lisp Parser
A Lisp parser based on Python's regular expression.
## Usage
- **Parse text:**
```python
root = lisp.ParseLisp(text)
```
- **Search node by name:**
```python
for node in root['name']:
print(node)
```
- **Search node by index:**
```python
node = root[0, 2, 1]
```
- **Get node's parent:**
```python
parent = node[...]
```
- **Get node by chain:**
```python
node = root['name', -1, ..., 2, 1, 0]
```
- **Get node's children:**
```python
for child in node:
print(child)
```
- **Get children's count:**
```python
count = len(node)
```
- **Get node's name:**
```python
node_name = str(node)
```
- **Compare with node's name:**
```python
print(node == 'name')
```
- **Check sub-node in node:**
```python
print('name' in node)
```