adamant-deprecated / adamant.tools.compiler Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: A compiler for the Adamant language that is in the process of being bootstrapped. Compiles to C.
Home Page: http://adamant-lang.org
DEPRECATED: A compiler for the Adamant language that is in the process of being bootstrapped. Compiles to C.
Home Page: http://adamant-lang.org
In order to avoid keyword conflicts emit all identifiers in C++ with a trailing underscore '_
'.
This prevents issues like what happened when the keyword this
was used in Adamant code and it compiled and ran, but the correct keyword in Adamant is self
.
This will also allow the use of normal names for operator calls and other compiler functionality.
When building locally, the "previous" version should actually be the current commit, not the parent commit.
Build should:
Once this is working correctly, we will stop committing the translated/previous versions to git.
Move the C++ code out of the main repo, either into a different repo or some file store.
Omitting the access modifier should be a compiler error.
Currently, the C++ code is emitted as the Adamant code is run. Instead, generate a syntax tree and then traverse it to emit the C++ code. This will allow for type checking and name resolution to be implemented on the syntax tree.
see EnumStruct.ad
Currently, the new
keyword is assumed to always generate a mutable instance. It shouldn't, the default should be immutable and you should have to use the mut
keyword. Note that it hasn't been determined if it should be mut new
or new mut
.
Auto-merge my branches during development.
Define branching strategy:
Rather than directly using the C++ primitive types, we should define our own primitive types in C++ named p_
to have proper control over how they work.
Currently, ->
is emitted for all member access. Change that so value types are emitted as .
. This will require being able to type check variables and expressions to determine if they are value types (#9).
Methods should take a self
parameter that determines whether self is mutable or not. Without the self
parameter they are supposed to be associated functions.
Currently, no naming binding is performed so there is no way to find out the kind or type of any name. We need to implement name binding and produce errors for names that don't reference anything,
Emit Adamant operators as method calls to avoid issues with the complexities of operator overloading in C++. This will require that primitive types are translated to structs in the runtime library. The operations can still be efficient by making the operator methods for primitives inline.
Especially on if
, while
, and return
.
To support cross-platform development, move the build batch files to a subdirectory and modify them to run from that directory.
The test cases should be run as part of a proper set of unit tests run by some kind of test harness. That way the outputs can be automatically compared and tests can focus on a fragment of code rather than needing to generate a whole file.
For value types that are class fields, they should be initialized to their default value if they aren't initialized in the constructor.
The compiler supports do while
statements while the reference says they aren't supported. Either remove them or change the language.
To support console debugging we need a static Debug.WriteLine in the runtime library
runtime
to RuntimeLibrary
For resources, the idea is to have an argument flag that allows you to specify resource files that will be included in the executable and be accessible through some kind of resource system calls.
Need to implement basic type check and be able to determine whether an identifier is a type name, value or reference. This is needed to properly emit .
vs ->
to C++.
Just use GitHub repo commits as packages.
Adamant properties should be converted to C++ methods named get_
and set_
.
Tests should be more rigorous. It should be allowed for tests to fail, what matters is a regression. That way tests can be written for planned functionality without implementing them right now. Organize tests by language version, then syntax vs semantics, then feature.
Note that this enables better support around generics because f < a > (b)
isn't valid code anymore.
The StringBuilder type should be implemented in Adamant so that it works properly and manages it's memory properly.
Currently, compiler errors show the file the error is in like so:
symbol_builder.ad:65:29 Error:
Missing token of type 27
However, it would be better if the whole path was output similar to how clang errors are formatted. This will enable VSCode file linking.
Example of clang error:
translated/current/Program.cpp:951:4: error: use of undeclared identifier 'Build_'
Build_(compilationUnit_, siblings_);
Changing the repo name appears to have broken the link with Travis CI. I think I fixed Appveyor, but Travis needs fixed too.
If a pull request is squashed or rebased, we can end up with tags that point to translated commits for commits that are no longer in the repo. Write either a script or a cake build task that will remove these both locally and remotely.
For now, we will support System.Collections.List in the Runtime Library as a C++ template so that we can use lists until it is possible to implement them in the standard library
The compiler assumes that types starting with a lowercase are value types when the convention actually says that immutable types are snake_case.
Given the transition to using an AST, the error reports no longer appear at the point in the output corresponding to the place in the code where they appear. This is because they are written to the output during parsing, but the code is now emitted later off the AST.
Need to gather errors into some collection with proper error messages and line numbers, then output and do not emit code if there are errors.
The translated commits currently contain only the SHA hash of the commit they are a translation for. Also, include the full commit message of the original commit.
The string
primitive type needs to correctly manage its memory and based on the lifetime. This may be most easily done by implementing it directly in Adamant.
Improve the build bootstrapping process. Consider using docker?
Perhaps constructors should be translated to special methods to avoid issues with C++ initializer syntax and to support named constructors.
#After the introduction of the Informal Spec, have a section that describes what's unique about Adamant and links to the relevant sections.
The Length
and Count
properties of various classes should be the magnitude operator |x|
instead.
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.