-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual
59 lines (40 loc) · 2.41 KB
/
manual
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
NAME
CLA interpreter - interpreter for CLA (Custom Language Abomination) written in TS
SYNOPSIS
There are 2 ways of running CLA interpreter:
- Using build-in npm scripts ($ npm start -- args...)
- Directly executing 'main.js' after TS transpilation ('$ npm run build' to build CLA interpreter)
DESCRIPTION
Read README.md for project description
USAGE
In order to interact with interpreter user MUST provide 'interactionMethod' (provided through: '-r' and '-f' flags)
You can learn more about CLA feature set by going through './tests'
For a more hands-on approach please refer to './codeExamples' (ready-to-run CLA programs)
OPTIONS
-h
Get help, print out the manual and exit with 0 exit code
-v
Turn on VERBOSE_MODE (increases output), mostly useful for debugging purposes
Supplying additional 'v' option will enable ULTRA_VERBOSE_MODE (outputs everything, including prototype-chain)
-e stage (possible values: 'l', 'lexer', 'p', 'parser', 'i', 'interpreter')
Execute interpreter up to a given 'stage' (useful for examining interpreter behaviour)
Automatically turns on VERBOSE_MODE
-r
Interact with CLA through REPL (sets 'interactionMethod' to 'REPL')
This option cannot be present alongside '-f' flag (contradicting behaviour)
-f filePath (when used with: '$ npm start' it's relative to the project's home directory)
Evaluate file located at 'filePath' (sets 'interactionMethod' to 'file')
This option cannot be present alongside '-r' flag (contradicting behaviour)
EXIT CODES
Exit code indicates whether interpreter succeeded in evaluation or failed for some reason
Different exit codes indicate different causes of interpreter failure
Tip: you can easily check exit code of the latest run command/script with: '$ echo $?'
0 Interpreter succeeded, no exceptions were raised
1 Required argument is missing (like 'filePath' after '-f' flag)
2 Provided argument is invalid
3 Lexer failed, exception was raised during tokenization process
4 Parser failed, exception was raised during AST build process
5 Interpretation process failed, an exception was raised during AST evaluation
6 Uncaught runtime exception
7 Uncaught runtime API exception
255 Internal interpreter error / developer fu**ed up!