Git Product home page Git Product logo

adamant.tools.compiler's People

Contributors

raelifin avatar walkercoderanger avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

raelifin

adamant.tools.compiler's Issues

Emit identifiers to C++ with trailing underscore

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.

Set up CI Builds

Build should:

  1. Compile translated/current of the previous commit
  2. Use that to compile the Adamant source to C++
  3. Fail the build if this does not match what is committed in the current commit translated/current
  4. Compile the translated/current of the current commit
  5. Use this to compile the test cases and fail the build if they do not match the expected values
  6. Bootstrap compile the Adamant source to C++using the compiler from step 4
  7. Use the bootstrapped version to compile the test cases and fail the build if they do not match the expected values

Once this is working correctly, we will stop committing the translated/previous versions to git.

Generate Syntax Tree

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.

Support mutable `new`

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.

Set up a System for PR Build and Merge

Auto-merge my branches during development.

Define branching strategy:

  • master is nightly
  • feature/* branches for dev
  • release/* branches used to stabilize for releases (branched off master)

Emit primitive types as `p_`

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.

Emit `.` for Value Type Member Access

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 `self` parameter

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.

Basic Name Binding

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 operators as method calls

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.

Run Test Cases in Proper Test Harness

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.

`do while`

The compiler supports do while statements while the reference says they aren't supported. Either remove them or change the language.

Improve handling of Runtime Library

  • rename runtime to RuntimeLibrary
  • embed the runtime library as a "resource" in the compiler and have it emitted as part of the compilation so that the runtime library version matches that of the generated code

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.

Basic Type Checking

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++.

Properties

Adamant properties should be converted to C++ methods named get_ and set_.

Better Testing Regieme

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.

In Compiler Errors, Output Full Path to File

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_);

Write Script or Build Task to Clean up translated tags

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.

Error Reporting Confusing

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.

Add Commit Message to Translated Commits

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.

string memory management and lifetimes

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.

Document Unique Features of Adamant

#After the introduction of the Informal Spec, have a section that describes what's unique about Adamant and links to the relevant sections.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.