The solidity wiki explains that standalone assembly is also possible. However, I cannot compile it. For example:

  mstore(0x40, 0x60) // store the "free memory pointer"
  // function dispatcher
  switch div(calldataload(0), exp(2, 226))
  case 0xb3de648b {
    let r := f(calldataload(4))
    let ret := $allocate(0x20)
    mstore(ret, r)
    return(ret, 0x20)
  default { revert(0, 0) }
  // memory allocator
  function $allocate(size) -> pos {
    pos := mload(0x40)
    mstore(0x40, add(pos, size))
  // the contract function
  function f(x) -> y {
    y := 1
    for { let i := 0 } lt(i, x) { i := add(i, 1) } {
      y := mul(2, y)

(Taken from solidity docs).

How do I compile this? I'm pretty sure I have to add some flag in solc. Is it possible to compile this in remix?

  • How did you compile your program? What error did you get? Did you try compiling from the command using solc?
    – Ismael
    Jul 23, 2018 at 3:14
  • I would like to directly compile this in remix.
    – JBrouwer
    Jul 24, 2018 at 0:06
  • That syntax doesn't appear to be supported by remix I'd suggest to create an issue in github for remix developers to consider adding this feature.
    – Ismael
    Jul 24, 2018 at 18:25

2 Answers 2


According to this GitHub the following question was asked regarding the status of standalone assembly:

Is this already implemented? It shows up in the documentation but I can see no other evidence of it being implemented: http://solidity.readthedocs.io/en/develop/assembly.html?highlight=assembly#standalone-assembly

Response to this by the contributor was

No, this is still work in progress. There is a note about it in the documentation, but not too visible, I have to admit.

This is the only evidence that I have got which is related to the above issue.


You can use my EVM assembler :)

It's extremely simple and compatible with solc --asm format

I'm currently using it in production without any issues, my current workflow is to use solc to output ABI files and substitute bin outputs with solcasm output


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.