Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from StellarWitch7/dev
Browse files Browse the repository at this point in the history
Update `main` with `dev` to keep the README up-to-date
  • Loading branch information
StellarWitch7 authored Jun 12, 2024
2 parents 5a8d8f3 + 3352ca8 commit dcea4cb
Show file tree
Hide file tree
Showing 151 changed files with 17,886 additions and 3,528 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.28.2",
"commands": [
"dotnet-csharpier"
],
"rollForward": false
}
}
}
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
189 changes: 181 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,137 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,git,direnv,rider,visualstudiocode,dotnetcore
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,git,direnv,rider,visualstudiocode,dotnetcore

### direnv ###
.direnv
#.envrc

### DotnetCore ###
# .NET Core build folders
bin/
obj/

# Common node modules locations
/node_modules
/wwwroot/node_modules

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand All @@ -23,16 +153,14 @@ mono_crash.*
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
[Rr]un/
[Bb]uild/
[Cc]ache/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down Expand Up @@ -64,6 +192,9 @@ project.lock.json
project.fragment.lock.json
artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml

Expand All @@ -89,6 +220,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -140,6 +272,11 @@ _TeamCity*
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
*.coveragexml
Expand Down Expand Up @@ -287,6 +424,15 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -343,6 +489,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -352,7 +501,31 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Other
.idea/
*.iml
.vscode/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
*.code-workspace

# Local History for Visual Studio Code

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml

### VisualStudio Patch ###
# Additional files built by Visual Studio

# End of https://www.toptal.com/developers/gitignore/api/visualstudio,git,direnv,rider,visualstudiocode,dotnetcore

[Rr]un/
[Bb]uild/

.idea
.vscode
2 changes: 1 addition & 1 deletion Moth.Compiler/Moth.Compiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartupObject>Moth.Compiler.Program</StartupObject>
Expand Down
83 changes: 58 additions & 25 deletions Moth.Compiler/Options.cs
Original file line number Diff line number Diff line change
@@ -1,58 +1,91 @@
using CommandLine;
using System.ComponentModel.Design.Serialization;
using System.ComponentModel.Design.Serialization;
using CommandLine;

namespace Moth.Compiler;

internal class Options
{
[Option('v',
"verbose",
Required = false,
HelpText = "Whether to include extensive logging.")]
[Option('v', "verbose", Required = false, HelpText = "Whether to include extensive logging.")]
public bool Verbose { get; set; }

[Option('n',
[Option(
'n',
"no-meta",
Required = false,
HelpText = "Whether to strip metadata from the output file. WARNING: disables reflection!")]
HelpText = "Whether to strip metadata from the output file. WARNING: disables reflection!"
)]
public bool NoMetadata { get; set; }

[Option("no-advanced-ir-opt",
[Option(
"no-advanced-ir-opt",
Required = false,
HelpText = "Whether to forego advanced optimizations to the IR.")]
HelpText = "Whether to forego advanced optimizations to the IR."
)]
public bool DoNotOptimizeIR { get; set; }

[Option('o',
[Option(
'o',
"output-file",
Required = true,
HelpText = "The name of the file to output. Please forego the extension.")]
HelpText = "The name of the file to output. Please forego the extension."
)]
public string? OutputFile { get; set; }

[Option('i',
"input",
Required = true,
HelpText = "The files to compile.")]
[Option('i', "input", Required = true, HelpText = "The files to compile.")]
public IEnumerable<string>? InputFiles { get; set; }

[Option('t',
[Option(
't',
"output-type",
Required = true,
HelpText = "The type of file to output. Options are \"exe\" and \"lib\".")]
HelpText = "The type of file to output. Options are \"exe\" and \"lib\"."
)]
public string OutputType { get; set; }

[Option("moth-libs",

[Option(
'V',
"module-version",
Required = false,
HelpText = "External Moth library files to include in the compiled program.")]
HelpText = "The version of the compiled module."
)]
public string? ModuleVersion { get; set; }

[Option(
'g',
"compression-level",
Required = false,
HelpText = "The type of compression to use for mothlib embedded metadata. Only really matters for huge projects. "
+ "Options are: \"none\", \"low\", \"mid\", and \"high\"."
)]
public string CompressionLevel { get; set; } = "mid";

[Option(
'm',
"moth-libs",
Required = false,
HelpText = "External Moth library files to include in the compiled program."
)]
public IEnumerable<string>? MothLibraryFiles { get; set; }

[Option("c-libs",

[Option(
'c',
"c-libs",
Required = false,
HelpText = "External C library files to include in the compiled program.")]
HelpText = "External C library files to include in the compiled program."
)]
public IEnumerable<string>? CLibraryFiles { get; set; }

[Option(
'e',
"export-for",
Required = false,
HelpText = "Languages to @Export() functions for. Use the file extension for the language."
)]
public IEnumerable<string>? ExportLanguages { get; set; }
}

public enum OutputType
{
Executable,
StaticLib
}
}
Loading

0 comments on commit dcea4cb

Please sign in to comment.