Questions tagged [ml-lex]

ML-Lex is a lexical analyzer generator for for Standard ML.

ML-Lex is a lexical analyzer generator for for Standard ML (). It is a variant of lex, and uses a similar syntax; it an ML program instead of a C program.

It is often used in conjunction with when making a parser in ML.

Resources:

See Also:

4 questions
3
votes
2 answers

building a lexical analyser using ml-lex

I need to create a new instance of a lexer tied to the standard input stream. However, when I type in val lexer = makeLexer( fn n => inputLine( stdIn ) ); I get an error that I don't understand: stdIn:1.5-11.13 Error: operator and operand don't…
noddy
  • 1,010
  • 4
  • 14
  • 27
1
vote
1 answer

File Input in ML-Lex

How to take input from a file after running ml-lex filename.lex and then using makeLexer function? I am trying to do : val lexer = makeLexer(fn n => valOf(inputLine(openIn("test.txt")))); [I have already done open TextIO; so that I am able to use…
sahilbansal17
  • 46
  • 1
  • 5
1
vote
1 answer

How to use Start States in ML-Lex?

I am creating a tokeniser in ML-Lex a part of the definition of which is datatype lexresult = STRING | STRINGOP | EOF val error = fn x => TextIO.output(TextIO.stdOut,x ^ "\n") val eof = fn () =>…
Chandan
  • 166
  • 2
  • 18
1
vote
1 answer

Error occuring in sml syntax of real.fromstring

I am new to sml and ml-lex. To convert string to real numbers we use the function real.fromstring. This is my code for conversion where yytext is an array of characters or a string. getOpt ((Real.fromString(yytext)), 0.0); I am using the above…
Cherry Cool
  • 69
  • 2
  • 7