# SJFL
SJFL is a simple language for configuration files. SJFL is a (syntactically and semantically) superset of JSON and a (syntactically) subset of Python. That means you can parse JSON files using a SJFL parser, and use Python syntax highlighters for SJFL files.
It's not a general-purpose script language. It's intended for config files. That means it's not turing complete.
## Syntax
- JSON
- A valid JSON document is a valid SJFL document.
- A few extensions on JSON
- Trailing commas
- Single quoted strings
- Comments with `#`s
- More ways of representing numbers
- `0x1234`
- `0b10101`
- `3.1415926535897932384626`
- Most implementations that use floating points cannot represent this value correctly. But this implementation does, thanks to [hmath].
- It also supports arbitrary-precision integers, thanks to [hmath].
- Any valid SJFL value can be a key of a table.
- For example, `{{[] : []} : {[] : []}}` is valid in SJFL.
- There're tradeoffs, though. It cannot check whether a table has multiple same keys.
- Variables
- See [this section](#statements) to see how to declare variables.
- Datetime
- `datetime(2024, 1, 20)` is 1st, January, 2024.
- It takes at most 7 arguments: `datetime(2022, 7, 16, 18, 30, 31, 0)` where the arguments are year, month, day, hour, minute, second and microsecond. The last 4 arguments are optional. When the optional arguments are missing, the default value 0 is given.
[hmath]: https://github.com/baehyunsol/hmath
## Statements
***For now, statements are not implemented... at all!***
Unlike Python, all the SJFL statements must be followed by a semi-colon.
- Assignments (TODO)
- You'll find it useful if you're using SJFL for config files. See the examples below to see what I mean.
- Rules for a name of a variable is the same as that of most other languages. (`[a-zA-Z_] [0-9a-zA-Z]*`)
- There are 7 keywords: `true`, `false`, `null`, `True`, `False`, `None` and `import`. You cannot use them as a variable name.
## Examples
TODO
## BSJFL
Everytime the engine parses a `.sjfl` file, it generates a binary version in the same directory, with `.bsjfl` extension. It reads `.bsjfl` next time if the raw text file has not been modified. It also re-parse the raw-text version if one of its dependency is modified.
Everything is done under the hood, and you don't have to care about it. You just modify `.sjfl` files, and do not touch `.bsjfl` files.
(TODO) All the binary conversions are done automatically. All you have to do is call `execute_file` function.