59 lines
2.7 KiB
Nim
59 lines
2.7 KiB
Nim
# Copyright 2022 Mattia Giambirtone & All Contributors
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import strformat
|
|
|
|
# Debug various components of peon
|
|
const debugLexer* {.booldefine.} = false
|
|
const debugParser* {.booldefine.} = false
|
|
const debugCompiler* {.booldefine.} = false
|
|
const debugVM* {.booldefine.} = false
|
|
const debugGC* {.booldefine.} = false
|
|
const debugMem* {.booldefine.} = false
|
|
const debugSerializer* {.booldefine.} = false
|
|
const PeonBytecodeMarker* = "PEON_BYTECODE"
|
|
const HeapGrowFactor* = 2 # How much extra memory to allocate for dynamic arrays and garbage collection when resizing
|
|
when HeapGrowFactor <= 1:
|
|
{.fatal: "Heap growth factor must be > 1".}
|
|
const PeonVersion* = (major: 0, minor: 1, patch: 0)
|
|
const PeonRelease* = "alpha"
|
|
const PeonCommitHash* = "b273cd744883458a4a6354a0cc5f4f5d0f560c31"
|
|
when len(PeonCommitHash) != 40:
|
|
{.fatal: "The git commit hash must be exactly 40 characters long".}
|
|
const PeonBranch* = "unboxed-types"
|
|
when len(PeonBranch) > 255:
|
|
{.fatal: "The git branch name's length must be less than or equal to 255 characters".}
|
|
const PeonVersionString* = &"Peon {PeonVersion.major}.{PeonVersion.minor}.{PeonVersion.patch} {PeonRelease} ({PeonBranch}, {CompileDate}, {CompileTime}, {PeonCommitHash[0..8]}) [Nim {NimVersion}] on {hostOS} ({hostCPU})"
|
|
const HelpMessage* = """The peon programming language, Copyright (C) 2022 Mattia Giambirtone & All Contributors
|
|
|
|
This program is free software, see the license distributed with this program or check
|
|
http://www.apache.org/licenses/LICENSE-2.0 for more info.
|
|
|
|
Basic usage
|
|
-----------
|
|
|
|
$ peon Opens an interactive session (REPL)
|
|
$ peon file.pn Runs the given Peon source file
|
|
|
|
Command-line options
|
|
--------------------
|
|
|
|
-h, --help Shows this help text and exits
|
|
-v, --version Prints the peon version number and exits
|
|
-s, --string Executes the passed string as if it was a file
|
|
-i, --interactive Enables interactive mode, which opens a REPL session after execution of a file or source string
|
|
-c, --nocache Disables dumping the result of bytecode compilation to files for caching
|
|
-d, --cache-delay Configures the bytecode cache invalidation threshold, in minutes (defaults to 60)
|
|
"""
|