Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit d60fb2c

Browse files
refactoring and update readme.md
1 parent 63053f1 commit d60fb2c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
# Python Regex Based Scanner
2-
an implemention of a lexical analyzer that tokenize a program using some regex rules
2+
3+
an "zero dependency" implementation of a lexical analyzer that tokenize a program using only official "re" package.
34

45
# Requirements
6+
57
Python 3.8
68

79
# How to use
10+
811
you can just put your rules in to the compiler_cli.py file and use it for yourself.
9-
12+
1013
this is how you can compile your code using compiler_cli.py
14+
15+
PS: you need to install [typer](https://pypi.org/project/typer/) to run the compiler_cli.
16+
1117
```sh
1218
python compiler_cli.py path/to/file
1319
```
1420

1521
# Example rules
22+
1623
```py
1724
rules = [
1825
('IF_KW', r'if'),
@@ -33,6 +40,6 @@ rules = [
3340
('EQUAL_OP', r'=='),
3441
('ASSIGNMENT_OP', r'='),
3542
('SEMICOLON', r';'),
36-
('IDENTIFIER', r'[a-zA-Z_]\w+'),
43+
('IDENTIFIER', r'[a-zA-Z_]\w*'),
3744
]
3845
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /