mirror of
https://github.com/nickmqb/wyre.git
synced 2025-12-06 02:30:42 -08:00
Update line endings
This commit is contained in:
parent
c989b49602
commit
a24c3ebdf4
3 changed files with 124 additions and 124 deletions
|
|
@ -1,8 +1,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
|
|
|||
178
compiler/main.mu
178
compiler/main.mu
|
|
@ -1,89 +1,89 @@
|
|||
//tab_size=4
|
||||
|
||||
main() {
|
||||
::currentAllocator = Memory.newArenaAllocator(256 * 1024 * 1024)
|
||||
|
||||
CrashHandler.enable()
|
||||
|
||||
argErrors := new List<CommandLineArgsParserError>{}
|
||||
parser := new CommandLineArgsParser.from(Environment.getCommandLineArgs(), argErrors)
|
||||
args := parseArgs(parser, true)
|
||||
|
||||
if argErrors.count > 0 {
|
||||
info := parser.getCommandLineInfo()
|
||||
for argErrors {
|
||||
Stderr.writeLine(CommandLineArgsParser.getErrorDesc(it, info))
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if args.printVersion || args.printHelp {
|
||||
Stdout.writeLine(format("Wyre compiler, version {}", compilerVersion))
|
||||
if args.printHelp {
|
||||
Stdout.writeLine("For documentation, see: https://github.com/nickmqb/wyre")
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
comp := new Compilation {
|
||||
sources: args.sources,
|
||||
errors: new List<Error>{},
|
||||
units: new List<CodeUnit>{},
|
||||
}
|
||||
|
||||
for sf, i in comp.sources {
|
||||
unit := Parser.unit(sf.text, comp.errors, args.indent)
|
||||
unit.path = sf.path
|
||||
unit.id = i
|
||||
comp.units.add(unit)
|
||||
}
|
||||
|
||||
Indexer.comp(comp)
|
||||
|
||||
top := comp.symbols.getOrDefault(args.top)
|
||||
if top.is(ModuleDef) {
|
||||
top.as(ModuleDef).flags |= ModuleFlags.top
|
||||
} else {
|
||||
comp.errors.add(Error { text: format("Top module not found: {}", args.top) })
|
||||
}
|
||||
|
||||
TypeChecker.comp(comp)
|
||||
|
||||
es := cast(null, EmulatorState)
|
||||
if comp.errors.count == 0 {
|
||||
es = Emulator.init(comp, top.as(ModuleDef))
|
||||
Emulator.reset(es)
|
||||
}
|
||||
|
||||
// Sort errors, but always show syntax errors first
|
||||
comp.errors.slice(0, comp.nonSyntaxErrorStart).stableSort(ErrorHelper.compareErrors)
|
||||
comp.errors.slice(comp.nonSyntaxErrorStart, comp.errors.count).stableSort(ErrorHelper.compareErrors)
|
||||
|
||||
if comp.errors.count > 0 {
|
||||
for e, i in comp.errors {
|
||||
if i >= args.maxErrors {
|
||||
break
|
||||
}
|
||||
if e.unit != null {
|
||||
Stdout.writeLine(ErrorHelper.getErrorDesc(e.unit.path, e.unit.source, e.span, e.text))
|
||||
} else {
|
||||
Stdout.writeLine(e.text)
|
||||
}
|
||||
}
|
||||
if comp.errors.count > args.maxErrors {
|
||||
Stdout.writeLine(format("{} errors ({} shown)", comp.errors.count, args.maxErrors))
|
||||
} else {
|
||||
Stdout.writeLine(format("{} errors", comp.errors.count))
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
out := VerilogGenerator.comp(comp, es)
|
||||
|
||||
if !File.tryWriteString(args.outputPath, out.sb.compactToString()) {
|
||||
Stderr.writeLine(format("Could not write to output file: {}", args.outputPath))
|
||||
exit(1)
|
||||
}
|
||||
|
||||
Stdout.writeLine(format("Generated output: {}", args.outputPath))
|
||||
}
|
||||
//tab_size=4
|
||||
|
||||
main() {
|
||||
::currentAllocator = Memory.newArenaAllocator(256 * 1024 * 1024)
|
||||
|
||||
CrashHandler.enable()
|
||||
|
||||
argErrors := new List<CommandLineArgsParserError>{}
|
||||
parser := new CommandLineArgsParser.from(Environment.getCommandLineArgs(), argErrors)
|
||||
args := parseArgs(parser, true)
|
||||
|
||||
if argErrors.count > 0 {
|
||||
info := parser.getCommandLineInfo()
|
||||
for argErrors {
|
||||
Stderr.writeLine(CommandLineArgsParser.getErrorDesc(it, info))
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if args.printVersion || args.printHelp {
|
||||
Stdout.writeLine(format("Wyre compiler, version {}", compilerVersion))
|
||||
if args.printHelp {
|
||||
Stdout.writeLine("For documentation, see: https://github.com/nickmqb/wyre")
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
comp := new Compilation {
|
||||
sources: args.sources,
|
||||
errors: new List<Error>{},
|
||||
units: new List<CodeUnit>{},
|
||||
}
|
||||
|
||||
for sf, i in comp.sources {
|
||||
unit := Parser.unit(sf.text, comp.errors, args.indent)
|
||||
unit.path = sf.path
|
||||
unit.id = i
|
||||
comp.units.add(unit)
|
||||
}
|
||||
|
||||
Indexer.comp(comp)
|
||||
|
||||
top := comp.symbols.getOrDefault(args.top)
|
||||
if top.is(ModuleDef) {
|
||||
top.as(ModuleDef).flags |= ModuleFlags.top
|
||||
} else {
|
||||
comp.errors.add(Error { text: format("Top module not found: {}", args.top) })
|
||||
}
|
||||
|
||||
TypeChecker.comp(comp)
|
||||
|
||||
es := cast(null, EmulatorState)
|
||||
if comp.errors.count == 0 {
|
||||
es = Emulator.init(comp, top.as(ModuleDef))
|
||||
Emulator.reset(es)
|
||||
}
|
||||
|
||||
// Sort errors, but always show syntax errors first
|
||||
comp.errors.slice(0, comp.nonSyntaxErrorStart).stableSort(ErrorHelper.compareErrors)
|
||||
comp.errors.slice(comp.nonSyntaxErrorStart, comp.errors.count).stableSort(ErrorHelper.compareErrors)
|
||||
|
||||
if comp.errors.count > 0 {
|
||||
for e, i in comp.errors {
|
||||
if i >= args.maxErrors {
|
||||
break
|
||||
}
|
||||
if e.unit != null {
|
||||
Stdout.writeLine(ErrorHelper.getErrorDesc(e.unit.path, e.unit.source, e.span, e.text))
|
||||
} else {
|
||||
Stdout.writeLine(e.text)
|
||||
}
|
||||
}
|
||||
if comp.errors.count > args.maxErrors {
|
||||
Stdout.writeLine(format("{} errors ({} shown)", comp.errors.count, args.maxErrors))
|
||||
} else {
|
||||
Stdout.writeLine(format("{} errors", comp.errors.count))
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
out := VerilogGenerator.comp(comp, es)
|
||||
|
||||
if !File.tryWriteString(args.outputPath, out.sb.compactToString()) {
|
||||
Stderr.writeLine(format("Could not write to output file: {}", args.outputPath))
|
||||
exit(1)
|
||||
}
|
||||
|
||||
Stdout.writeLine(format("Generated output: {}", args.outputPath))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
../../muon/lib/core.mu
|
||||
../../muon/lib/basic.mu
|
||||
../../muon/lib/stdio.mu
|
||||
../../muon/lib/string.mu
|
||||
../../muon/lib/containers.mu
|
||||
../../muon/lib/memory.mu
|
||||
../../muon/lib/environment.mu
|
||||
../../muon/lib/random.mu
|
||||
../../muon/lib/range.mu
|
||||
../../muon/lib/sort.mu
|
||||
cstdlib.mu
|
||||
ast.mu
|
||||
parser.mu
|
||||
command_line_args_parser.mu
|
||||
args_parser.mu
|
||||
error_helper.mu
|
||||
indexer.mu
|
||||
type_checker.mu
|
||||
type_checker_utils.mu
|
||||
type_checker_builtins.mu
|
||||
range_finder.mu
|
||||
emulator_init.mu
|
||||
emulator.mu
|
||||
tape.mu
|
||||
verilog_generator.mu
|
||||
main.mu
|
||||
--output-file wyre.c
|
||||
../../muon/lib/core.mu
|
||||
../../muon/lib/basic.mu
|
||||
../../muon/lib/stdio.mu
|
||||
../../muon/lib/string.mu
|
||||
../../muon/lib/containers.mu
|
||||
../../muon/lib/memory.mu
|
||||
../../muon/lib/environment.mu
|
||||
../../muon/lib/random.mu
|
||||
../../muon/lib/range.mu
|
||||
../../muon/lib/sort.mu
|
||||
cstdlib.mu
|
||||
ast.mu
|
||||
parser.mu
|
||||
command_line_args_parser.mu
|
||||
args_parser.mu
|
||||
error_helper.mu
|
||||
indexer.mu
|
||||
type_checker.mu
|
||||
type_checker_utils.mu
|
||||
type_checker_builtins.mu
|
||||
range_finder.mu
|
||||
emulator_init.mu
|
||||
emulator.mu
|
||||
tape.mu
|
||||
verilog_generator.mu
|
||||
main.mu
|
||||
--output-file wyre.c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue