thomas-de-bock / construct Goto Github PK
View Code? Open in Web Editor NEWCompiler for an x86 Assembly language abstracting over NASM
License: MIT License
Compiler for an x86 Assembly language abstracting over NASM
License: MIT License
using boost 1.84 worked
-Iboost_1_84_0/
edit: boost is a library
file 'src/deconstruct.h'
#include<boost/algorithm/string/classification.hpp>
#include<boost/algorithm/string/split.hpp>
#include<boost/algorithm/string.hpp>
I would like to create some PR with improvements, however, I would like to use c++17 and c++20 features.
Have you decided in any maximum standard to support?
Or I can go wild with newer c++ versions?
A help message should show when running Construct with no arguments, or if the -h
or --help
flag is set. The help message could provide details about version, and usage. Here is a help message example:
Construct (version 1.1.0)
An abstraction over x86 assembly providing useful shortcuts and syntax.
Usage:
-i Input file. Should have valid construct syntax, and optionally have the extension .con
-f Output format. Can be either elf64, elf32, elf16, or elf8
-o Output file. Specifies where to put the resulting assembly file.
2024 Code_Nybble
MIT LICENSE
https://github.com/Thomas-de-Bock/construct/
When running Construct with one of the examples (factorial.con
), I get a malloc error. Construct should handle these gracefully and provide detailed error messages and fail gracefully.
blue@computer ~/D/c/examples [1]> construct -f elf64 -i factorial.con -o out.asm
construct(26020,0x1dd1d5ec0) malloc: *** error for object 0x600003bfc000: pointer being freed was not allocated
construct(26020,0x1dd1d5ec0) malloc: *** set a breakpoint in malloc_error_break to debug
fish: Job 1, 'construct -f elf64 -i factorial…' terminated by signal SIGABRT (Abort)
Hello!
I love this compiler and find it super interesting :)
I've open a PR on NixOS/nixpkgs#289114 to get this utility available on nixpkgs.
This will allow other nixpkgs packages to depend on it to build their code, create my own flakes environment with this tool available and installing it easily with nix/ home-manager/ nix-env / nix-shell.
Construct's command line arguments are awkward and hard to understand. To fix this, Construct could follow the likes of nasm
, which is invoked like
nasm -f elf64 -o cool.o cool.asm
The input file doesn't use a flag, instead it is an unnamed argument. Also, flag names could have alternative long names, like --format
for the -f
flag, and so on.
Adding support for outputting Mach-O assembly instead of Elf would be awesome (as of writing this, running on macOS produces errors when assembling & linking binaries produced by Construct)
FTS i was working on the project makefile and work dir and failed to contrib.
and i decided to give you the makefile anyway.
# Compiler and it's stuff
CXX := g++
CFLAGS := -Wall -Wextra -march=native -I ./
ifeq ($(DBG),1)
CFLAGS += -g # debug flag: make DBG=1
endif
# Output and Srcs (for objects).
SRC := inc
OUT := ../out
SRCS := $(wildcard $(SRC)/*.cpp)
OBJS := $(patsubst $(SRC)/%.cpp, $(OUT)/%.o, $(SRCS))
# Dest Bin
ifndef ($(TARGET))
BIN := ../bin
TARGET := $(BIN)/construct # out filename
endif
# ENTRY argument could be useful for test compilation.
ifndef ($(ENTRY))
ENTRY := construct.cpp
endif
# Exposed
.PHONY: init all clean
# Building Objs
$(OUT)/%.o: $(SRC)/%.cpp
@echo "CXX $@ $<"
@$(CXX) $(CFLAGS) -c $< -o $@
# Target build
$(TARGET): $(OBJS) $(ENTRY)
@echo "CXX $@"
@$(CXX) $(CFLAGS) -Wl,--build-id=uuid $^ -o $@
# Entry
all: $(TARGET)
# Init wd
init:
@echo "* INIT"
@mkdir -p $(BIN) $(OUT)
# Clean wd
clean:
@echo "* CLEAN"
@rm -rf $(BIN) $(OUT)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.