I am following the truffle tutorial for creating a token. I get this error when trying to compile the contract.

ParserError: Expected identifier, got 'LParen'
    constructor () public {

Here is the code for the contract

pragma solidity ^0.4.24;

import "node_modules/openzeppelin/solidity/contracts/token/ERC20/StandardToken.sol";

contract AirtimeToken is StandardToken {
    string public name = "AirtimeToken";
    string public symbol = "AirTK";
    uint8 public decimals = 18;
    uint public INITIAL_SUPPLY = 12000;

constructor () public {
    totalSupply_ = INITIAL_SUPPLY;
    balances[msg.sender] = INITIAL_SUPPLY;



I tried passing in the properties as params in the constructor and got the same error

UPDATE: link to StandardToken.sol

  • 1
    There doesn't appear to be anything wrong with the code you provided, could you add the contract code from StandardToken.sol too? – AnAllergyToAnalogy Jun 16 '18 at 4:37
  • I have updated the question with the link to the parent smart contract – Bernard 'Beta Berlin' Parah Jun 16 '18 at 8:16
  • You might be on an older version of truffle / solc . Try running truffle version, your solc version should be equal or higher than 0.4.22. That’s when “constructor” started being supported. – pabloruiz55 Jun 17 '18 at 11:41

I had a similar problem. In my case it was the system version of solc I had installed. Here's what I had. I had solc installed through Homebrew, and also truffle installed. when I run truffle version:

Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)

So I had the latest version of truffle and seemingly, solc as well. However, when I run solc --version

solc, the solidity compiler commandline interface
Version: 0.4.19+commit.e67f0147.Darwin.appleclang

My system solidty version was different. I found that I had installed solidity through Homebrew (on Mac), so that was different from the version truffle was using. So the fix in my case, was to upgrade solidity using homebrew, it upgraded from 0.4.19 to 0.4.24 and my problem went away. To upgrade solidity using Homebrew:

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity
brew linkapps solidity

The first two lines are probably all you need if you already have solidity installed, but added the rest for completeness.

While this was on Mac, the same isuse might exist on Linux. Make sure you update the system installed version of solc, not just what's installed with truffle.


pragma solidity^0.4.17 replace constructor with a function Tokenization()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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