Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. interpreter needed

interpreter needed

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jerome Conus
    wrote on last edited by
    #1

    Hi ! My C++ app needs to read an external text file and display it on screen. But, this text file can contain specific commands to change what has to be displayed by my app. For instance, the text file could be : Hello [if foo] Foo [else] Bar [endif] and my app should display (depending of foo) : Hello Foo. The problem is that I don't know where to start. Should I just parse the text file and just check each [] ? Should I write a real interpreter (I have no idea how to do this). Can I reuse something existing ? Any help, suggestions or idea are welcome ! THanks ! Jerome

    M 1 Reply Last reply
    0
    • J Jerome Conus

      Hi ! My C++ app needs to read an external text file and display it on screen. But, this text file can contain specific commands to change what has to be displayed by my app. For instance, the text file could be : Hello [if foo] Foo [else] Bar [endif] and my app should display (depending of foo) : Hello Foo. The problem is that I don't know where to start. Should I just parse the text file and just check each [] ? Should I write a real interpreter (I have no idea how to do this). Can I reuse something existing ? Any help, suggestions or idea are welcome ! THanks ! Jerome

      M Offline
      M Offline
      mark novak
      wrote on last edited by
      #2

      Depends how hardcore you want to get. If it's simple you could get away with just parsing and using a simple hash table for your variables. Either way you'll want to take a look at these [http://www.codeproject.com/cpp/crafting\_interpreter\_p1.asp](http://
      http://www.codeproject.com/cpp/crafting_interpreter_p1.asp)[[^](http://
      http://www.codeproject.com/cpp/crafting_interpreter_p1.asp)] http://www.codeproject.com/cpp/crafting_interpreter_p2.asp[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups